Idiomatic way to change 2 derived signals when input signal changes
Hi, I've created a discussion at github https://github.com/solidjs/solid/discussions/1953 but it seems not very active place there.
Sorry for duplicate.
GitHub
Idiomatic way to change 2 derived signals when input signal changes...
Hi! Great framework! I read the docs on createSignal, createMemo, createComputed multiple times but haven't found a way to solve this problem: import { render } from "solid-js/web"; i...
7 Replies
you could do something like
createEffect(on(inputItems, () => setShowLastX(SHOW_PER_PAGE)))
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
ideally you don't set signals in effects either, but i think in this case it's fine
got it, thanks. can we be sure that
items
is only calculated once when inputItems
changes? because (inputItems->allItems->items) and (inputItems->effect->setShowLastX->items). i.e. items
depends on two different thingsa i see, no ur right it will run twice when pressing
change input items
(nvm what i said about computed, had a bug in the code)ok i cracked it
https://playground.solidjs.com/anonymous/ab439cdc-3bb5-496d-ad8d-50c699addfca
order matters
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
thanks!