3 ms·
8 years ago I was using jQuery and good self contain JS objects. Each of them had responsibility over specific part of the DOM. The beauty of that is that in t
by ChrisCinelli 7y ago
8 years ago I was using jQuery and good self contain JS objects. Each of them had responsibility over specific part of the DOM. The beauty of that is that in that why you can keep thing simple and updates already well optimized by default.
I understand that by default with JS you can write code that in one place touch every part of the page.
But no framework or language protect you from bad code practices and bad abstractions. They may avoid it at a specific abstraction level but unless you are disciplined and you know what you are doing, you are still screwed beyond that.
Component libraries like React did not invent encapsulation, abstractions, separation of concerns, loose coupling and high cohesion, they just enforce them at their level of abstraction but let you paying the "unoptimized" recalculate all by default.
In fact I saw a bunch of code written in React that are big balls of mud communicating together without a good abstraction logic.
Redux, in the React ecosystem, is pretty good at keep the state in one place but pretty bad to hide implementation details to those component that should not be concerned with them... result? Refactoring a reducer can results in refactoring a lot of smart components. And the verbosity of using Redux has always been off the chart.
The best part of React documentation is here:https://reactjs.org/docs/thinking-in-react.html https://reactjs.org/docs/thinking-in-react.html - Especially in steps 3 and 4. Learn that and use it with the framework of choice or just vanillaJS... You do not use that and you will be in trouble with React or any other framework.