You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { assoc } from 'ramda';
import { writable } from 'svelte/store'
let store = writable({});
store.update(assoc(123, "four"))
but this does:
store.update(prev => assoc(123, "four", prev))
so does this:
store.update(prev => ({...prev, [newId]: thingToCreate})))
to reduce boilerplate it would be nice to have store update function try apply its argument to previous state
because assoc(id, item) is much less than prev => {...prev, [id]:item}
and that's just the simplest case. we might build partial functions on the fly and apply them to state. If state doesn't accept curried functions from ramda, then we cannot possibly do functional programming in svelte, and developers must hand-code every edge case
The text was updated successfully, but these errors were encountered:
Hi,
Svelte is cool to write less code. So is Ramda.
Right now, this doesn't work:
but this does:
so does this:
store.update(prev => ({...prev, [newId]: thingToCreate})))
to reduce boilerplate it would be nice to have store update function try apply its argument to previous state
because assoc(id, item) is much less than prev => {...prev, [id]:item}
and that's just the simplest case. we might build partial functions on the fly and apply them to state. If state doesn't accept curried functions from ramda, then we cannot possibly do functional programming in svelte, and developers must hand-code every edge case
The text was updated successfully, but these errors were encountered: