hook
const picOrClusterOptions = useMemo(
() =>
type === 'casa'
? reportState.porta.map(portal=> ({
value: porta.portaId,
label: porta.portaName,
}))
: reportState.piso.map(porcel=> ({
value: piso.pisoId,
label: piso.pisoName,
})),
[reportState.piso, reportState.porta, type],
);
tsx
<Select
id="reportIds"
classNamePrefix="custom-select"
className={`form-control ${
selectItemsLoading ? 'loading light' : ''
}`}
options={picOrClusterOptions}
value={picOrClusterValues}
onChange={handleReactSelectPicOrClusterOnChange}
isMulti
closeMenuOnSelect={false}
/>