4 ms·
The state is completely handled by the parent. So the component itself is indeed stateless. Basically, the message is: Avoid having components with local state
by cardanome 4y ago
The state is completely handled by the parent. So the component itself is indeed stateless.
Basically, the message is: Avoid having components with local state, especially if it needs to be synchronized with the parent. Instead have one central place to handle state. Which is generally good advice and not really that Elm specific.
- hobofan 4y agoBeing restricted to only one central place means you have to wire everything to that central place. This usually results in writing manually mapping boilerplate between X different message types, which is one of the worst parts in every Elm(-inspired) project I've seen.
- KasMA1990 4y agoYeah, if you do mapping all over like that, it can get really bad. The solution, I feel, is to avoid the mapping by pushing more things closer to that central place (as outlined in the article). At least this works well for us when building a web client, but I can't speak to how easy it is if you're using that architecture for other purposes.