I have an app im building in reactjs and react native. I have an array in my state that I'm adding image uri's to.
state = {
images: []
}
The problem lies in that I want to add images uris to this array at a specific index like this
//pass the index I want the image uri assigned to
pickImage = (imageIndex) => {
let result = await ImagePicker.launchImageLibraryAsync({
allowsEditing: true,
aspect: [4, 3],
});
if (!result.cancelled) {
this.setState({images[imageIndex]: result.uri})
}
}
however, the above doesn't work, can someone point me in the right direction?
Thanks
{images[imageIndex]: result.uri}is not a valid object literal.