Skip to content
Discussion options

You must be logged in to vote

So I think I may have figured this out. Would appreciate a sanity check though.

Here's the updated demo: https://stackblitz.com/edit/6ppf3ucz?file=src%2FSelectButtons.tsx

I'm using your original idea of applying the same filter function on the data set as what's used in Autocomplete, but instead of a user having to pass it in, I'm just baking that into component logic.

Here is the code:

export default function SelectButtons() { const selectState = useContext(SelectStateContext); const autoCompleteState = useContext(AutocompleteStateContext); const { contains } = useFilter({ sensitivity: 'base' }); const handleClearAll = useCallback(() => { selectState.setValue([]); }, [sele…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@mryechkin
Comment options

@snowystinger
Comment options

@mryechkin
Comment options

@mryechkin
Comment options

Answer selected by snowystinger
@snowystinger
Comment options

@mryechkin
Comment options

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