react filter map code example
Example 1: use map with filter in react components from arrays of data
<div>
{names.filter(name => name.includes('J')).map(filteredName => (
<li>
{filteredName}
</li>
))}
</div>
Example 2: map and reduce an array in js
const rebels = pilots.filter(pilot => pilot.faction === "Rebels");const empire = pilots.filter(pilot => pilot.faction === "Empire");