I want to call setProps
from outside of myComponent
to be able to dynamically change data for myComponent
.
I expect that after changing props of the component, it will re-render itself.
I was trying the following:
var myComponent = React.createClass({
render: function () {
return (
React.DOM.div(null, this.props.data)
);
}
});
React.renderComponent(
myComponent({ data: someData }),
document.getElementById('predictionContent')
);
myComponent.setProps({data: someData2});
The problem is that I don't understand how to use setProps
for the component.
In my case, I receive "undefined" error.
How to solve this?