javascriptreactjsreact-instantsearch

Filter by two items react-instantsearch


I am sure this is probably a beginner issue but, I am trying to filter by both ongoing and all_day. How can this be achieved in the same .filter()?

<CurrentRefinements
  transformItems={items =>
    items.filter(item => item.attribute !== 'ongoing', 'all_day')
  }
/>

Solution

  • To include more than one condition, add it using && or ||:

    items.filter(item => item.attribute !== 'ongoing' && item.attribute !== 'all_day')