React on Rails addons

How can i use react-addons?
I used to do it in gem react-rails like this

var index, records;
index = this.state.records.indexOf(record);
records = React.addons.update(this.state.records, {
  $splice: [[index, 1, data]]
});
return this.replaceState({
  records: records
});

how would i use React.addons.update in react_o_rails?

What doesn’t work in React on Rails. This looks like standard JavaScript.

I got it working using the immutability-helper package.

  1. Go to the client folder in the terminal.
  2. Type ‘npm install immutability-helper --save’ into the console.
  3. import update from ‘immutability-helper’;
  4. var posts = update(this.state.posts, { $push: [post] });
    this.setState({
    posts: posts
    });

The addons.update method is deprecated.