3 ms·
But I haven't written that input-process-output equals functional. I just pointed out that the React model allows for a larger piece of the code to be functiona
by xixixao 11y ago
But I haven't written that input-process-output equals functional. I just pointed out that the React model allows for a larger piece of the code to be functional, in exactly the same way it's done, say, in Haskell. This has nothing to do with monads. Monads are used for the imperative, stateful code that is pushed to the top of the call stack, the bit which is partially managed by React for you (by calling the render method).
I would also never claim that React invented any of this. It just popularized this more declarative approach for building Web UIs
- stream_fusion 11y agoI thought your analogy was spot on. In React, the view is reduced down to a functional projection of the model - rather than being a complicated set of state interaction patterns (eg. mvc,mvvm). The React framework then handles the real DOM update - in the same way that a Monadic IO computation is not executed directly - but instead is passed to the Haskell IO runtime to be executed.