S
SolidJS3w ago
Lȩge

Idiomatic Props

ATM I'm passing a Signal<T> to a component, which of course boils down to [() => T, (value: T) => void]. However I could also do it with [T, (value: T) => void] and use the reactivity provided by prop instead of relying on a Signal. The second case seems more idiomatic?
1 Reply
bigmistqke
bigmistqke3w ago
Passing a signal as a prop in solid is generally not considered idiomatic as it goes against a base philosophy of solid: read/write segregation. Instead a more typical pattern is <Comp value={signal()} onValue={setSignal} />

Did you find this page helpful?