optionLabel don't work as a function
I'm trying to use useSelect function with a custom label, for this the documentation says that you can use optionLabel as a function but is not working
I'm doing it like this:
I'm doing it like this:
const { selectProps: vehiclesSelectProps } = useSelect({
resource: "vehicles",
optionLabel: (item: any) =>
`${item.type.model}-${item.type.provider}-${item.plate}`,
});optionLabel in useSelect was suggested in a Github issue (https://github.com/refinedev/refine/issues/4880), but it's not clear if this feature has been implemented yet.optionLabel and optionValue are used to change the value of your options and they accept a string as their value. Here is an example from the documentation (https://refine.dev/docs/data/hooks/use-select/#optionlabel-and-optionvalue):options prop of the Select component. Here is an example from a Github issue (https://github.com/refinedev/refine/issues/4880):optionLabeloptionLabeluseSelectoptionValueSelectuseSelect({
optionLabel: "name",
optionValue: "categoryId",
}); const { selectProps, queryResult, defaultValueQueryResult } = useSelect({
resource: "resource",
});
const allOptions = [
...(queryResult?.data?.data || []),
...(defaultValueQueryResult?.data?.data || [])
];
<Select
{...selectProps}
options = {allOptions.map((p: IPoint) => ({
label: `${p.location_name} - ${p.landmark}`,
value: p.id
}))}
/>