This was developed for React v0.14 and it doesn't work in newer versions. See Emmanuel Ogbizi's react-mirror as an alternative.
Mirror any react component.
Given any wrapped react component, e.g. <Surface>
component</Surface>
, react-mirror allows you to mirror those components within any other component's render
method, placing any number of <Mirror />
.
-- Each mirror is a full clone of the DOM Node it reflects, being replaced by a new clone for each reported mutation. Therefore, don't use this method in order to get a performance boost. --
class Demo extends Component {
componentDidMount () {
this.refs.mirror.reflect(this.refs.surface)
}
render () {
return (
<div>
<Surface ref="surface">
<SomeOtherComponent />
</Surface>
<Mirror ref="mirror" />
</div>
)
}
}
Surface will render any react component without being appended to the DOM tree.
PARAMS | DEFAULT | DESCRIPTION |
---|---|---|
initialMirror |
true |
Automatically creates a Mirror for this Surface . |
equalityTest |
true |
Accepts any primitive value (taken as boolean) or a function to retrieve that value given previous and next props from the wrapped component as arguments.This value represents the equality comparison of the given arguments. So, when NOT positive, it will update Surface 's internal ReactElement with the next one.* If you pretend to pass down updated props to the wrapped component you have to specify some other value than true here. Like false or any shallowEqual implementation out there. |