Skip to content

Preserving the selection order in Multi-Select component #3646

Closed Answered by diegohaz
sidx1024 asked this question in Questions
Discussion options

You must be logged in to vote

If you use controlled state, you can sort the value yourself:

const [value, setValue] = useState(["Apple", "Cake"]);
value.sort((a, b) => a.localeCompare(b));

<SelectProvider value={value} setValue={setValue}>

Replies: 1 comment 3 replies

Comment options

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

@diegohaz
Comment options

@sidx1024
Comment options

Answer selected by sidx1024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants