Skip to content

Instantly share code, notes, and snippets.

@joecritch
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joecritch/476806f0174ed74791ec to your computer and use it in GitHub Desktop.
Save joecritch/476806f0174ed74791ec to your computer and use it in GitHub Desktop.
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
Copy link
Author

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