Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We moved from HTML + jQuery to React.

Why? In a large part, it's because writing reusable components in React makes a world of difference AND is a lot more readable. The jQuery code was a mess of accessing DOM elements and was liable to break without warning when updating the HTML.

The other thing is that it's much easier to write a functional, complex UI. React will attach and detach listeners for you, will create and delete elements, etc. You are not going to be writing lots of hard-to-read boilerplate in onClick handlers. Finally, combined with something like Redux, you get a single-source-of-truth backing the UX, which avoids a lot of the issues I've seen in other jQuery codebases, where there are race conditions between various components during initialization.

It's a completely different way of writing a UI, but I don't see myself going back to the traditional paradigm.

> The only thing I can think of is that appendChild is a bit tedious, but createClass seems even more boilerplate.

You can't compare the two. A component is made of any number of HTML elements and other components, it's not like you are going to use createClass every time you need to want to display a span.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: