3 ms·
Alternatively, one of the consequences of React is that the front-end can largely be unit-tested. You can at least get a pretty good idea that the page will ren
by mod 10y ago
Alternatively, one of the consequences of React is that the front-end can largely be unit-tested. You can at least get a pretty good idea that the page will render what you expect if it gets the data you expect.
And whether or not it gets that data is a unit test in another place.
I'm not a huge fan of React, or javascript, but having been forced to work in it, this is one of the wins.
- computerex 10y agoYou could test the front-end before react though? Also, one can still have a God component. I don't think React changed anything from a testability point of view. Well written modular code is well written modular code.
- foota 10y agoI would argue that the case that React makes for testability is abstracting DOM manipulation in a way that is highly testable.
- computerex 10y agoFrameworks like Knockout have been around for quite some time now. You don't have to use React to not depend on the DOM. There are many alternatives to "jQuery based front-end development" that's not React. Aurelia, for instance, happens to be an amazing framework in my opinion that's also highly testable and that's not React. Like I said, modular code is modular code. You can write good, modular code with just require js modules, and you can also write terrible monolithic React components. Testability isn't the domain of the view layer. Abstracting the DOM into a declarative DOM is great for performance, but doesn't lead to necessarily more testable code.