11 ms·
React was a mistake of the last decade. React itself is a great academic idea (i.e. pure functions, composability), but the whole React-Redux boilerplate mess (
by igammarays 7y ago
React was a mistake of the last decade. React itself is a great academic idea (i.e. pure functions, composability), but the whole React-Redux boilerplate mess (I dare not call it an "ecosystem" because that word implies harmony of some sort) is the the result of an entire generation of code monkeys and job seekers who didn't design their technology stack with any real engineering consideration, but rather on the basis of tool popularity, feeding a vicious cycle of "lean startup" companies spending a glut of VC money looking for the fastest way to hire more React code monkeys because they think "that is how you do engineering".
- randall 7y agoNot to interrupt a good rant against tech (in this era... very brave, btw) but you should look at react with the context api. I think everyone who’s used it is glad it removed redux’s boilerplate insanity. There’s even some other frameworks (the name escapes me now) that are like boilerplateless redux if ppl like that style of event driven state updates.
- acemarke 7y agoHi, I'm a Redux maintainer. Please check out our new official Redux Toolkit package. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once: https://redux-toolkit.js.org https://redux-toolkit.js.org Also, note that we have a new "Style Guide" docs page which specifically recommends patterns that we feel will lead to simpler code, like the "ducks" structure for single-file Redux logic: https://redux.js.org/style-guide/style-guide https://redux.js.org/style-guide/style-guide Finally, we're currently working on a major rewrite of the Redux core docs, with the goals of updating them for today's target audience and teaching easier-to-use patterns: https://github.com/reduxjs/redux/issues/3592 https://github.com/reduxjs/redux/issues/3592 (and by "we" I basically mean "me", since I'm not getting a lot of help with this effort so far.) I'll also point out that while Context is a great tool for making data available to a nested subtree of components, it has major limitations in terms of processing frequent updates. We tried to use it internally in React-Redux v6, and it just wasn't sufficiently fast enough, which is why we had to rewrite the internals again in v7 to use direct subscriptions instead. So, very useful, but not a replacement for Redux.
- erulabs 7y agoHi, I'm a software engineer. Thank you for your work on Redux - I think it's fantastic! Lots of hate in this thread, but React/Redux are great, even if that somehow makes me an imposter or a hipster or whatever the tools I use somehow say about me.
- acemarke 7y agoThanks, and you're welcome! I obviously didn't _create_ Redux, but I'll take a decent amount of credit for helping keep it relevant over the last few years (docs work, blog posts, answering questions, React-Redux updates, Redux Toolkit). I'll say up front that it's definitely not as "necessary" as it was early on and that there's lots of other great alternatives out there, but yeah, I don't get the recurring waves of "I hate Redux" that seem to pop up on Twitter every few months. FWIW, I talked about some Redux usage stats and where it fits in compared to other options in my "State of Redux" talk at Reactathon last year: https://blog.isquaredsoftware.com/2019/03/presentation-state-of-redux/ https://blog.isquaredsoftware.com/2019/03/presentation-state... Looks like I should get to do an updated version of that talk later this year.
- kabes 7y agoReact != redux. I really like react, I really hate redux, so I use react without redux and it works just fine (we actually use tracker+minimongo from meteor for our app state and really like it)
- pier25 7y agoMy enjoyment of React grew exponentially once I moved from Redux to MobX.
- Phillips126 7y agoI second this. In my last largish application, state was getting really messy and I needed a place to keep it all organized. I really tried hard to get Redux to work as at the time it was the tool that everyone was talking about. I struggled and couldn't make sense of it. Eventually I stumbled upon MobX and it just clicked. So easy to work with and checks all of my boxes. Productivity and happiness soared :)
- dnautics 7y agoI can put a junior in react and be fairly sure that nothing too crazy will happen. I can't say the same for angular.
- Bahamut 7y agoI wouldn’t say the same no matter the domain - junior devs can and will surprise you, and because React gives you less guardrails for app architecture, it likely has the potential to go far worse.
- dnautics 7y agoWell obviously they'll be CR'd. If you stick to prop drilling and functional code there's far less you can do abjectly wrong.
- Bahamut 7y agoExcept wire up routing in a strange way, or pick a library for form validation or form framework, or come up with odd ways of structuring tests, picking a strange approach for animations, etc. This is the cost when app architecture gets delegated to your developers over a high quality central solution, the quality is as good as your developers.
- dnautics 7y agoThose are the parts where you put a senior in charge. Hell I can't even do that in React, and have in the past literally hired a contractor to set that up for me.
- dragonwriter 7y ago> If you stick to prop drilling and functional code Juniors new to React are unlikely to do so, IME (as a semi-new-to-React not-junior working on a team with new-to-React junior-ish devs -- by experience; there isn't a formal junior/not-junior distinction on our team.) OTOH, if you do things you really shouldn't do in React, while they won't all be flagged, there's a very high probability it will result in at least related warnings pointing to it in the devtools console, so that's something.
- Pmop 7y agoOh man, don't say it. I've just started to learn React to improve my chances of landing into my first job, since all Java positions are either full-time or requires >4 years of previous relevant experience.
- monadic2 7y agoFor better or worse, react is and will remain very employable.
- moksly 7y agoI wouldn’t worry about that. React won the framework war in most industries. The only places who really utilise Angular in my area are the same companies who build the JAVA backends you can’t get hired for, and even some of them are switching to react. All in all you shouldn’t worry too much about employability if you pick and stick with something popular. Check your local job-market and stop worrying about what’s hipster cool on HN. There hasn’t been a single Rust or Go job listing in my entire region of Denmark for an entire year, mean while there are currently around 150 PHP positions open right now.
- technoplato 7y agoYour thoughts on Hooks? Is it just the pairing of React / Redux you find unappealing? Your feedback is disappointingly vague but you seem passionate about it so I assume there’s something deeper here.
- crubier 7y agoI have the exact opposite opinion. React is the only sane way to do web development. All other approaches are deeply flawed by either relying on imperative mutations of the DOM instead of clean declarative code, or by relying on ugly templating syntax and data attributes instead of just using JS basic constructs like react. The power of react is just at its beginning, as we can see with things like react-three-fiber that was coded in a weekend initially and which is unthinkable in any other framework. Edit typo
- dreamer7 7y agoExactly! JSX is much easier to use compared to angular templating.
- Nican 7y agoI agree. I have to develop for both Angular and React for work, and I find my experience with React so much more relaxing. The logic between the what I see and what I think is straight forward. What I see is what I get. JSX is great. Meanwhile, for Angular, I keep constantly going back to the documentation, trying to remember all the small details about templating, binding, decorators, modules, dependency injection, etc...
- tannhaeuser 7y agoI'm not a React hater (in fact, I like it a lot when it fits) but I think when people criticize React, they're actually after the one-size-fits-all attitude displayed in comments such as yours. No, React is clearly not "the only sane way of doing web development" considering the web hosts many types of markup applications, the most successful ones predating React by decades.
- crubier 7y agoOnly sane way, you missed a word. Of course there are other ways, but they clearly flawed in my opinion. I used to hate web development before 2014 and now I love it. Php is an awful language, jquery was a nightmare. Angular makes no sense hence why it keeps reinventing itself, Vue forces you to have some logic expressed using an ad hoc language in templates like it’s 2010 instead of just using JS constructs etc... I stand by my point, I am yet to find a use case where some form of react is not the best solution. Whether it is server side rendered, a single page app, or statically rendered. The only criticism I hear about react boil down to people complaining about bad practices that are not linked to react, but merely conflated with it, like not caring about bundle size, messing architecture or other aspects that are orthogonal.
- dreamer7 7y agoWow! such a strong opinion warrants some more justification. Having used both Angular (since 1.0) and React (only recently), it's obvious why React is more popular. Any decent engineer can be productive in React within a day since the concepts are so intuitive and simple. With Angular, if you don't really know how things work, you are going to struggle a lot for a while. While i can't speak for the rendering performance, the design itself is definitely elegant and not built for "code monkeys" but real engineering productivity
- asmodlol 7y agoIf for you extrapolating types trying to fit a square into a circle every variable declaration and having 10 lines of decorators per file means less boiler-plate then yes angular is the better framework.
- mrighele 7y agoI use React and I find it fine. I don't use Redux though, so it may be the reason why we had different experiences. I think that just by using Hooks and Contexts you can get a lot done in a predictable way without adding too much complexity. With typescript and a proper IDE you get also wonderful type-checking and refactoring capabilities. I used AngularJs (1.x) a lot before and in comparison it was both more complex and full of unexpected behaviors. I have less experience with Angular (2+), but I found it much more complex and in some parts over engineered.
- npmn 7y agoPeople who despice react because of redux(Boilerplate) should try mobx.
- s_y_n_t_a_x 7y agoOr you know, use Redux because the boilerplate is gone... https://redux-toolkit.js.org/ https://redux-toolkit.js.org/ You don't have to create actions or constants anymore, you just create your reducer functions and selectors, then use hooks to select and dispatch in your components. Never got why people took up a completely different paradigm just because they couldn't figure out how to reduce their boilerplate...
- kls 7y agoOr use XState as Redux is only a half implementation of a state machine. It get's the job done but a state machine gives you far more structure and comprehensibility around state management. https://github.com/davidkpiano/xstate https://github.com/davidkpiano/xstate
- s_y_n_t_a_x 7y agoWhich is great because you don't need a full state machine. React can be that other half...
- azangru 7y ago> the whole React-Redux boilerplate mess... is the the result of an entire generation of code monkeys and job seekers who didn't design their technology stack with any real engineering consideration What do you even mean? Redux was a simple and elegant implementation of the unidirectional data flow (aka the Flux pattern). It came out during the time when the state of the art was Angular 1.x (aka AngularJS)'s two-way data binding, requiring a lot of dirty checking. Redux might or might not (the story is moot) have been influenced by Elm, which has exactly the same concept of actions, state modifications in response to actions, and re-renders in response to state modifications; all as pure functions; and Elm developers are finding this approach enjoyable and predictable. But even Elm aside, the pattern that redux is using, i.e. communicating via messages (actions) and subscribing to state changes in connected components, is a variation on the age-old, battle-tested event sourcing and pub/sub. What's so bad about that?