Ad
Filter Multiple Lists Using Fuse Js At The Same Time
I have 3 lists generated via API. I want to filter these lists at the same time using Fuse js. I checked the documentation and could not find the solution for filtering multiple lists.
I don't know how to pass 3 different lists as a parameter to the Fuse method.
this.state = {
a: [],
b: [],
c: [],
}
filterVal = (e) =>{
let searchOptions = {
keys:['name'], //name is common key across all 3 lists
includeMatches: true
}
var fuse = new Fuse(a,b,c, searchOptions); //not sure how pass 3 lists here
var filteredResult = fuse.search(e.target.value); //passed the user input value
}
Ad
Answer
You can merge list like:
var fuse = new Fuse([...a, ...b, ...c] , searchOptions)
Ad
source: stackoverflow.com
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?
Ad