4 ms·
your question resolves to when to choose imperative vs OO v functional, and while I'm not going to try to discuss that here, they are profoundly different. Wina
by dustingetz 11y ago
your question resolves to when to choose imperative vs OO v functional, and while I'm not going to try to discuss that here, they are profoundly different. Winapi is imperative, React is functional.
- coldtea 11y ago>Winapi is imperative, React is functional. That's a red herring. That would be relevant if we were discussing the imperative vs functional methodology. But what the article discusses is the similarity in the architecture of two view management systems. And even more so, the imperative changes in the Windows scheme described are encapsulated inside the views, and the overall system is more functional that you give it credit for. But, again, I think that this is beside the point.
- duncanawoods 11y agoI call forceUpdate to trigger redraws when view state is managed outside of props. Feels like an imperative redraw to me. https://facebook.github.io/react/docs/component-api.html#forceupdate https://facebook.github.io/react/docs/component-api.html#for...
- aljones 11y agoWell, yeah. That isn't the recommended way to use react.
- duncanawoods 11y agoIts pretty essential for non-trivial applications with data-structures more complex than can be handed over to React. setState is just sugar - it also calls forceUpdate.