17. Filter Function in React Js || how to delete item in react js || React JS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome to the session in last session we understand about the map function and in this session we will learn about filter function which is almost like map function but it have pretty different use case so to demonstrate the filter function let's take the same array and in new array what we do is we simply do a r dot filter and it also give us item so it also give us index let's take item and index both and here what we do is we either return true or return false we either return true or return false now i return true directly and all the items are rendered is that in array but if i return here false then what happen is the array become empty because it filtered the all the items in this array as they are not required so we should use certain condition to return what to return so in return if i say item not equal to zone then see what happen the zone get deleted from the array item item not equal to zone means this is equal to n this will become false right and other will become true so don't get deleted so in like this we can remove certain item from the array and we can also remove certain index from array like if we do index not equal to not equal to 2 let's see 2 so in index 2 what is there let's give it 2 2 equal to so index 2 is what zero index one index two index right so james got removed so what it does is is base it is basically used to remove certain item to filter out certain item from the array and summing up what we can say that map is used to bring change in the area item and filter is used to remove certain area item based on certain condition so this filter is also a higher order array function given by js itself and that's it the use case of filter so in next video we will learn about event handling and outputting dynamic content in the react so thank you for watching
Info
Channel: Something New
Views: 2,675
Rating: undefined out of 5
Keywords: filter function in react js, how to delete data in react js, how to remove data in react js, use filter function in react, remove data using filter function, react js tutorial, react tutorial, react tutorial for beginner, react js, SPA in react, why we use react
Id: OlD5-vqpens
Channel Id: undefined
Length: 3min 20sec (200 seconds)
Published: Thu Jan 20 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.