3 ms·
This is more of a criticism of modern web development, and not specific to React. A modern web developer has to install node, webpack, babel/typescript, react,
by jinushaun 8y ago
This is more of a criticism of modern web development, and not specific to React. A modern web developer has to install node, webpack, babel/typescript, react, redux, sass/less just to write HTML, Javascript and CSS. It's especially frustrating for newbies since ES6/JSX and React always seem to "travel together." But you can write non-ES6 and non-JSX React.
- https://reactjs.org/docs/react-without-es6.html https://reactjs.org/docs/react-without-es6.html
- https://reactjs.org/docs/react-without-jsx.html https://reactjs.org/docs/react-without-jsx.html
This is what all the JSX and ES6 compile down to. It's just not as fun.
But React at its core is very simple: Same props always render same UI. Different props always render different UI.
add(1, 2) -> 3
add(2, 1) -> 3
add(2, 2) -> 4
That's the core principle. And it is the drive to organise your code into declared props that naturally drive how your React code is organised.
add({'num1': 1, 'num2': 2}) -> 3
add({'num2': 2, 'num1': 1}) -> 3
add({'num1': 2, 'num2': 2}) -> 4
It's a reaction to the unpredictable nature of "typical" jquery code where data and actions flow in both direction and it became difficult to pinpoint why something changed. If you clean up how you use jquery and are disciplined about it, you will eventually build something like React. There's no magic to React. The virtual DOM is not React. It's just an optimisation.
Same with Redux. When you eventually start writing large React applications, you will eventually end up re-inventing something similar to Redux.