Last active
August 14, 2016 21:30
-
-
Save mathisonian/e7ec771d67fd2237ee52936833f2a33d to your computer and use it in GitHub Desktop.
2 copies of react
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// dependencies looks like | |
// { | |
// "react": "X.Y.Z", | |
// "victory": "X.Y.Z" | |
// } | |
// | |
exports.decorateTerm = (Term, { React, notify }) => { | |
// this library calls require('react') internally | |
const Victory = require('victory'); | |
return class extends React.Component { | |
render () { | |
const children = []; | |
children.push(React.createElement(Term, Object.assign({}, this.props, { key: 'key1' }))); | |
children.push(React.createElement(Victory.VictoryChart, {key: 'key2'}, React.createElement(Victory.VictoryLine))); | |
return React.createElement('div', {style: {width: '100%', height: '100%', position: 'relative'}}, children); | |
} | |
} | |
}; | |
// gives error: | |
// invariant.js?4599:38 Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner). | |
// breaks future rendering updates |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment