how to filter when array react code example
Example 1: filter array react
<div>
{people.filter(person =>
person.age < 60).map(filteredPerson => (
<li>
{filteredPerson.name}
</li>
))}
</div>
Example 2: react js filter array of on search
use .include array function
{names.filter(name => name.includes('J')).map(filteredName => (
<li>
{filteredName}
</li>
))}