logo
Updated

Solid

try get jazz running with solid

finish listening to (min 55)

Nice video on signals. Mutable Derivations in Reactivity is good article too.

Links

Notes

reactive == createMutable (or createStore with read/write segregated syntax)
shallowRef == createSignal
computed == createMemo (it's eager, for a lazy one there is createLazyMemo in solid-primitives)
signals and memos have a { equals: (prev, next) => prev === next } option by default, which will prevent updates if the next value is the same
watchEffect == createEffect
watch == createEffect + on
v-for == For, Key, or Index depending on what you want use as key
v-if == Show or a ternary in jsx
props are getters just like in vue, but there is no automatic inheritance of props
slots == props: { myslot: JSX.Element } (use a callback to pass data)
emits are just callbacks
withDefaults == mergeProps
refs are just callbacks (ref={el => {...}})
onMounted == onMount
onUnmounted == onCleanup
also each computation (effect, memo, in jsx too) will cleanup everything created inside on rerun. I think it's kinda similar to effect scope in vue, but here it's automatic, so you can have onCleanup in effect to clean the last side effect on change