Skip to content

Fuzzy-search using useFilter? #2785

Discussion options

You must be logged in to vote

I used the custom filtering section by only replacing it with fuse.js (demo → https://codesandbox.io/s/combobox-with-fuse-js-t7u4c?file=/src/App.tsx)

const fuse = React.useMemo(() => new Fuse(timezonesList, options), []);
  const filteredItems = React.useMemo(
    () => fuse.search(filterValue).map((tz) => tz.item),
    [filterValue, fuse]
);

Eventually, replaced fuse.js with https://github.com/ajitid/fzf-for-js as fuse was giving a bug but fzf worked fine! Only need to replace the above section a bit :)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@deadcoder0904
Comment options

@deadcoder0904
Comment options

@snowystinger
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by deadcoder0904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants