Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react-native array.filter by index arrow function

//
// in react-native, removing an item from an array. SelectedStoryPhotos is the array name, remember item is the array item, index is it's position in the arry, picture
// index is the index of the array item you want removed passed in.
// 
	this.setState(state => {
		const selectedStoryPhotos = state.selectedStoryPhotos.filter((item, index) => pictureindex !== index);
		return {selectedStoryPhotos,
		};
	});
 
PREVIOUS NEXT
Tagged: #index #arrow #function
ADD COMMENT
Topic
Name
9+8 =