5 ms·
It's hard to believe that you have serious experience in react. Or maybe you've just never seen it down correctly... I have the exact opposite take. Before rea
by cjonas 5y ago
It's hard to believe that you have serious experience in react. Or maybe you've just never seen it down correctly... I have the exact opposite take.
Before react I hated UI programming so much. But the way react deals with state makes it so much easier to build and maintain complex applications.
All you have to do is define how your application responds to any given state and provide explicit controls for asking to update that state. If you do that correctly, your application will be predicable and easy to reason about.
The biggest challenge is it's just not the normal imperative programming model that most devs are used to. It takes time and understand to do correctly, but what doesn't?
- reboog711 5y ago> But the way react deals with state makes it so much easier to build and maintain complex applications. Real question; not being snippy... I didn't think React had any state management included. A lot of people I've spoken to seem to use Redux, a third party library for handling state. Is my understanding incorrect?
- cjonas 5y agoReacts out of the box "useState" along side the unidirectional data flow acts as a lightweight, yet very powerful form of state management. Redux takes that to the next level but is based on similar principles of "reactive" programming. For complex state heavy applications it's extremely powerful, but often overkill for many smaller applications.
- acemarke 5y agoHi, I'm a Redux maintainer. React has always had "state management" built in in the form of component state: `this.setState` in class components, and `useState/useReducer` in function components. Those work just fine. However, that _is_ limited in that you can only access state inside the current component, or pass it down the tree as props/context. If you need to access data broadly across the component tree, or the data itself does not lend itself to a tree-shaped usage pattern, or you need to minimize the number of components that re-render when you update, or you need to use it _outside_ the component tree, then you may want to look at an external state management library. I've talked about the tradeoffs in these approaches numerous times: https://blog.isquaredsoftware.com/2021/01/context-redux-differences/ https://blog.isquaredsoftware.com/2021/01/context-redux-diff... https://changelog.com/posts/when-and-when-not-to-reach-for-redux https://changelog.com/posts/when-and-when-not-to-reach-for-r... https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/ https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-... All that said: React makes writing an application with any meaningful amount of complexity _vastly_ easier to do than trying to do it with either preceding UI frameworks (AngularJS 1.x, Backbone, etc) or jQuery. It isn't perfect, but it's well-suited for a wide range of application development use cases.
- LAC-Tech 5y agoReact has 'useReducer' now, which can replace redux for most use cases. But I also think 'react' means two different things. One the one hand, it's "just a library". In industry, it tends to mean... react + JSX + react-router + redux + react-this + react-that + react-redux-this-and-that all tied together with create-react-app. Plus its own command line tools, and browser plugins. It starts to feel very much like a framework then, if not a platform of its own.
- kristopolous 5y agoI've been using it daily for 5 years and have been programming professionally for about 25. My criticisms of react can fill many pages (and what more, I've written them). I'll readily admit to being a passionate radical about this stuff. The things I have to say are basically just a bunch of bomb throws and I don't feel this is the appropriate place nor do I have the requisite time. Rest assured, I've put in a considerable amount of time and effort into my thoughts on the matter and we'll likely disagree, but let's not do that here.
- cjonas 5y agoHave you posted your thoughts anywhere online you could share? I'd like to read them just to get perspective of the other side
- LAC-Tech 5y agoDon't mean to blow too much smoke but I really liked this response. I don't know if I could be that reasonable if a piece of tech I liked was attacked.
- kristopolous 5y agoIt's reasonable. I know people care and disagree with me and that's welcome. I'll think about how to best present it gently and prepare something. The stuff I have is really much more for the STS people who think Silicon Valley should literally be dismantled brick by brick. That's a different audience than my fellow startup engineers (I've got my feet in many conflicting camps)
- cjonas 5y agoAs someone who has to make impactful "tech stack" decisions on a daily basis, I try to challenge my personal preferences as often as I can. When someone has a strong negative take on something I thought was great, that's a perfect opportunity to learn deeply about trade-offs or concerns I might not be fully aware of. If nothing else, it gives me an opportunity to evaluate potential issue, put guards in place to reduce the impact, and arms me to defend my choices should the need arise.