3 ms·
One thing I'm wondering with elm is how does it deal with state across different components? I.e. where would you put the settings of the current user and how w
by d0m 10y ago
One thing I'm wondering with elm is how does it deal with state across different components? I.e. where would you put the settings of the current user and how would you access that within one component? (By component I mean the (init,update,view,subscription))
- redka 10y agoSince with The Elm Architecture parent always takes care of it's children you can create a "Context" and pass it along.
- ccapndave 10y agoAnother approach is to use extensible records, which give you structural typing similarly to Typescript. This means that you can pass the exact same state record/object around to different components, but a particular component might only specify that the state needs to have a `user` property, whereas another might only specify that the state needs to have a `friends` property.