How can I return items that match a condition? [duplicate]

I'm using map which returns me html elements:

const activeStep = 1;

{ => (
  <MarketItem el={el} />

But how I can made some condition, which returns me the same elements which is responding to condition.

So , when activeStep === 1 , I need to return only elements from filteredData which have the key and value like this el.isSelected === true, in other case if activeStep !== 1 I need to return all elements from filteredData even el.isSelected !== true

Read more here:

Content Attribution

This content was originally published by Vlad Movchan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: