r/javascript • • Aug 27 '15

Stop Using React for EVERYTHING!

https://medium.com/@zackargyle/stop-using-react-for-everything-c8297ac1a644
3 Upvotes

131 comments sorted by

View all comments

7

u/te7ris Aug 27 '15

give me one good reason NOT to use react for everything.

-1

u/geuis Aug 27 '15
  • search engine reachable content

  • content intended to be embedded in other sites

  • non-js browsers

That's 3.

14

u/daedius Web Components fanboy Aug 27 '15
  • Isomorphic react libraries?

  • iframes?

  • React native?

5

u/KhalilRavanna Aug 27 '15

Also per the first one you can also render react on the server and serve the rendered HTML. No libraries (outside of react) required.

1

u/xxxabc123 Aug 28 '15

No libraries (outside of react) required.

Assuming server also works on javascript. If you're running let's say Java or Ruby, you're going to need even weirder hacks to execute in a javascript environment such as Rhino. Even if node.js makes it relatively easy, this would be quite hard for big teams where front-end and back-end developers might never meet during their employment, as I'm currently experiencing.

1

u/theQuandary Aug 28 '15

The React render to string methods make a string from the vdom and return it. That should work perfectly well in Rhino or any other ECMAScript compliant implementation.

For large projects that need to be isomorphic, a great solution is to spin rendering off into a separate node process. Your java, python, ruby, or whatever passes in the required data and gets back a string that can be returned to the client and (in a lot of cases) cached for reuse.

Your front-end team is going to have to write this template code anyway. The benefit here is that it allows more graceful upgrades on the client and allows the client to reuse as much of the back-end as possible (which reduces template overhead and potential conflicts).

If large companies like Netflix or Facebook (with PHP no less) can make these ideas work, then I don't doubt that other companies can as well.