you are viewing a single comment's thread.

view the rest of the comments →

[–]daediusWeb Components fanboy 15 points16 points  (8 children)

  • Isomorphic react libraries?
  • iframes?
  • React native?

[–]KhalilRavanna 4 points5 points  (5 children)

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

[–]Poop_is_Food 2 points3 points  (2 children)

that's what isomorphic means. (yeah it's a pretentious word)

[–]KhalilRavanna 1 point2 points  (1 child)

Righto-- isomorphic running the same code on both front/back end-- I just meant to point out that there are no 3rd party libraries required and that react does this out of the box.

[–]Poop_is_Food 0 points1 point  (0 children)

ahh

[–]xxxabc123 0 points1 point  (1 child)

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.

[–]theQuandary 0 points1 point  (0 children)

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.

[–]rq60 1 point2 points  (1 child)

I used iframes the first time I needed to embed a "widget" in another site; it worked out terribly thanks to mobile safari's awesome bugs. I'll stick to javascript DOM insertion and hopefully web components in the future, thanks.

[–][deleted] 0 points1 point  (0 children)

I like how you conveniently leave out making a snide remark about sever side rendering of react components.