Instantly share code, notes, and snippets.

Embed
What would you like to do?
using React.addons.update + splice to replace array elements by key
var points = React.addons.update(this.state.points, {
$splice: [
[
this.state.myIndex,
1,
{
latLng: latLng,
place: true,
title: title
}
]
]
})
@joecritch

This comment has been minimized.

Copy link
Owner

joecritch commented Jun 30, 2014

This would create a new array, with a replaced object, positioned at whatever this.state.myIndex is equal to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment