Within the autocomplete compenent, I would like to control the way that results are ordered by providing the autocomplete component with an optional search function.
Currently results are ordered in the same order that they are given within the options prop, however I would like to have the results ordered by specified ranking function that is passed to the autocomplete as an optional prop.
// we need a way to sort the array of strings within filtered,
// based on a provided search function passed in as a prop
const filtered = options.filter((optionsName) =>
optionsName.toLowerCase().includes(value.toLowerCase())
);
Within the autocomplete compenent, I would like to control the way that results are ordered by providing the autocomplete component with an optional search function.
Currently results are ordered in the same order that they are given within the
options
prop, however I would like to have the results ordered by specified ranking function that is passed to the autocomplete as an optional prop.for example:
If a search function is not provided the autocomplete should display results as it is currently doing.