I feel the way you use the inject decorator in order to pass the state to all of your components is…
Ethan Sharabi

You make a good point. I didn’t do a good job of explaining that part.

The idea I’m going for is that there are no smart components. All components are dumb, and all [real] logic is in MobX stores. That makes code easier to work with because you’re using a central state machine, and the UI is just an expression of its state. (actions are the transitions)

Where it gets muddy is finding a good criteria for “This is just view logic” vs. “This is logic logic”. I don’t think smart/dumb components solve that problem either.

Is it okay to have `something ? <Foo /> : <Bar />` statements in dumb components? I think it is.

What I like about inject is that it just adds stuff to props. So if you wanted to move to a smart/dumb component system, all you’d have to do was to replace the inject statements with passing dicts in props, and moving your logic out of MobX stores and into smart components.

Not sure why you’d want that, though.

Like what you read? Give Swizec Teller a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.