Hacker News new | ask | show | jobs
by mrtksn 2937 days ago
Because React doesn't manipulate the DOM directly you're leaving every convention and tool about DOM manipulation behind, which means that the moment you want to do something more complex than composing components you either have to re-invent the wheel or use the brand new wheels that somebody re-invented.

React is brilliant but makes simple stuff that no one was thinking on anymore hard and complex again. So if you don't want to think about how to handle an AJAX request and an animation like it's 2004 you can just slap a library on top of React(and worry about the page size and loading strategies).

React is a statement, a revolution, it is about disowning the old Web and building it from scratch.

1 comments

fetch and CSS handle AJAX and animation absolutely fine with native calls and work well with React, why would you bring in a library to handle these?
You bring animation libraries in when your UI animations don't necessarily match the component lifecycles and you don't want to do something basic. Well, you don't have to bring in animation libraries but then you'll have to engineer it by yourself and handle all the quirks.

In React you simulate a DOM(or whatever) instead of working on a DOM that's handled by the browser(or whatever).

It's just like the difference of a real-world physics and simulated physics. In the real world, you can throw a rock and the nature will handle everything. On a simulation, you will have to think about all kind of details to make your simulation as realistic as possible.

I don't really see how complex animations is something React (or any UI framework) should be responsible for ?
Who should be responsible if not the UI framework?

Oh, and by complex, I don't mean character animation or something. It's the stuff that is supposed to act differently than the React's internal workings.

For example, if you want to do an animation on items that disappear when the user takes an action it's not going to be easy as with plane JS manipulating the DOM. Also, you won't be able to use some nice artistic animations that were created by direct DOM manipulation.