lucas
lucas
SSolidJS
Created by lucas on 5/30/2024 in #support
Destructuring functional props remove reactivity ?
Non working example (direct destructuring) :
<Select
placeholder="Select a running app"
onChange={setSelectedAppProcess}
loading={openedAppsOptions().length === 0}
{...props}
{...filterableOptionsProps()}
/>
<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)}
/>
<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 !
17 replies