SolidJSS
SolidJSโ€ข2y agoโ€ข
16 replies
lucas

Destructuring functional props remove reactivity ?

Non working example (direct destructuring) :
<Select
  placeholder="Select a running app"
  onChange={setSelectedAppProcess}
  loading={openedAppsOptions().length === 0}
  {...props}
  {...filterableOptionsProps()}
/>

(filterableOptionsProps is a signal)

I was wondering if there is a better way than this to keep reactivity :

<Select
  placeholder="Select a running app"
  onChange={setSelectedAppProcess}
  loading={openedAppsOptions().length === 0}
  {...props}
  options={(inputValue) => filterableOptionsProps()?.options?.(inputValue)}
  optionToValue={(option) => filterableOptionsProps()?.optionToValue?.(option)}
  isOptionDisabled={(option) => filterableOptionsProps()?.isOptionDisabled?.(option)}
  format={(item, type) => filterableOptionsProps()?.format?.(item, type)}
/>

Is Split props the way to go ?
I could not get it work since my props are inside a signal i think ...

Any hint for a better solution is welcome !
Have a nice day !
Was this page helpful?