How can I change the state of a React component from old old jQuery soup code?
I have a component like this:
var AComponent = React.createClass({ getInitialState: function() { return { ids: [] } }, render: function() { ... }, onButtonClick: function() { ids.splice(β¦);
When something happens in the old jQuery code, I would like to click id on AComponent.state.ids . How can i do this?
One βobviousβ solution is an anti-pattern; there he is:
var componentInstance = AComtonent({}); React.renderComponent(componentInstance, document.getElementById(...));
This is antipattern, according to this letter from the Facebook developer , because he writes that componentInstance can be destroyed by React.
source share