Skip to content

Instantly share code, notes, and snippets.

@mathisonian
Last active August 14, 2016 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathisonian/e7ec771d67fd2237ee52936833f2a33d to your computer and use it in GitHub Desktop.
Save mathisonian/e7ec771d67fd2237ee52936833f2a33d to your computer and use it in GitHub Desktop.
2 copies of react
//
// 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