Skip to content

Instantly share code, notes, and snippets.

@mathisonian mathisonian/index.js
Last active Aug 14, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.