4 ms·
React, Redux and other such libs solve the problem while overcomplicating the programming model. My point is that 99% of applications don't need the complexity
by petilon 8y ago
React, Redux and other such libs solve the problem while overcomplicating the programming model. My point is that 99% of applications don't need the complexity introduced by surgically making the smallest possible change in the DOM to refresh the page. There are simpler libs out there that eliminate 99% of the complexity of React, Redux etc while providing 99% of the benefits.
- s_y_n_t_a_x 8y agoYou don't get much simpler than Redux. And React by itself is very simple, you don't even have to use JSX. It's a great templating library, with great documentation and a huge community.
- petilon 8y ago>You don't get much simpler than Redux. Not true. With Redux you write reams of actions and reducers and other such unnecessary crap in the name of state management, when in fact most client apps don't have state, all they do is fetch data from the server, display it, send updates back to the server. React used to be a simple lib, now it is getting more and more complicated. Look at the libs I mentioned they are way simpler. >you don't even have to use JSX But JSX is the good part of React. You get compile-time checking of your expressions if you use TypeScript and you get syntax coloring, intellisense etc for both HTML and JavaScript.
- s_y_n_t_a_x 8y agoIf you don't need state, don't include it. That's the beauty of React. But as far as a state management lib goes, Redux is one of the simplest, go look at the source. I agree JSX is very nice. It's one of the best features of React, and another reason React is a great templating lib. My point was you don't need it. React does a lot of other nice things like browser compatibility, event management. If you want a smaller implementation, use preact or some other template lib. When dealing with React and Redux you are just dealing with functions. You could do everything in pure functions.
- petilon 8y agoReact requires too much incantations, rituals and ceremony. You have props and state, context, error boundaries, refs, keys, you have to figure out where state should live, etc. You make a component that contains state. Then you want to use it in a component hierarchy -- now the component is supposed to have props not state. You make a component that has props, now you want to use it at the top level -- now the component is supposed to have state, or have an otherwise unnecessary wrapper. You don't have to deal with any of that crap. The best part of React is DOM diffing and incremental screen update. Obviously this is only useful if your application needs to update screens it previously rendered. In fact I'd argue that React is only useful if you need to incrementally update complex screens, because simple screens can be re-rendered completely and no one will know the difference. Very few applications need to incrementally update complex screens. If your application doesn't have this need you can use simpler technologies that don't have the same "Care and feed" requirements of React, such as UIBuilder: https://github.com/wisercoder/uibuilder https://github.com/wisercoder/uibuilder
- s_y_n_t_a_x 8y agoYou don't have to deal with any of that crap when you deal with react. Just write pure functions as components. The arguments are the props.
- petilon 8y agoThen you aren't benefiting from React at all. The point of React is DOM diffing, which you trigger using setState method.
- s_y_n_t_a_x 8y agoWhen you change the props of a component it re-renders. Just because you use pure functions doesn't mean you don't get DOM diffing, that's silly.
- petilon 8y ago