Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

client mounting option #15

Closed

Conversation

super-cache-money
Copy link

The client mounting support is usable without requiring modification of your react view.

It works like this:

  1. The react view is prerendered to a string.
  2. The JSX for the view is compiled into normal JS.
  3. The view's JS is tweaked to be able to render the component client-side.
  4. This JS is injected, along with the react library, to the tail of <body> in the prerendered string markup.

Caveat: The view render options are visible in the injected JS. This includes options.settings which contains some (sensitive?) information.

Client mounting functions by injecting javascript at the end of the
HTML body which mounts the react component over the entire document
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@super-cache-money super-cache-money changed the title Added client mounting option client mounting option Nov 27, 2014
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@zpao
Copy link
Member

zpao commented Nov 27, 2014

A couple big questions before we get into a thorough review…

How did you test this?

How does this work if the target view uses require (beyond just require('react'))? I'm not sure you actually can make it work without creating a bundle (with browserify, webpack, etc) or some other layer on top that understands require.

@super-cache-money
Copy link
Author

I've done some light testing with an app I'm building. Hardly stringent, I must concede.

Regarding browserify: I really overlooked that! It'd make this more solid. So I presume the view's JS should be run through browserify right after it's been transformed from JSX...I'm on it.

@zpao
Copy link
Member

zpao commented Oct 29, 2017

I'm going to close this out and say if you need this much, use something else like https://github.com/zeit/next.js/

@zpao zpao closed this Oct 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants