Change state of React component from old external Javascript?

后端 未结 1 1268
野趣味
野趣味 2021-02-10 07:56

How can I change the state of a React component from my old legacy jQuery soup code?

I have a component like this:

var AComponent = React.createClass({
          


        
1条回答
  •  孤独总比滥情好
    2021-02-10 08:29

    I would make the component stateless. Store the ids array outside of your component and pass it as a prop with functions that will modify the array. See example on JSFiddle: http://jsfiddle.net/ohvco4o2/5/

    0 讨论(0)
提交回复
热议问题