-
-
Save joecritch/476806f0174ed74791ec to your computer and use it in GitHub Desktop.
using React.addons.update + splice to replace array elements by key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var points = React.addons.update(this.state.points, { | |
$splice: [ | |
[ | |
this.state.myIndex, | |
1, | |
{ | |
latLng: latLng, | |
place: true, | |
title: title | |
} | |
] | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would create a new array, with a replaced object, positioned at whatever
this.state.myIndex
is equal to.