Layout feature proposal
See original GitHub issue(full disclosure, I’m writing this fork atm, would love to be able to issue a PR later to add it into the main stream)
My use case: I want the entire document tree (HTML, Head, etc) rendered by React on the server (controlled by a Store, etc) but this is problematic on the Client if you want to have the ability to embed third party scripts, analytics, etc. So you need to have the client render the core of your app somewhere in the Body.
If you render into a component other than HTML (when you’re controlling the whole document on the server) then checksums will fail (assuming renderToStaticMarkup) because the reactroot
is different when you render on the client - and if you don’t use checksums then you’re blitzing the node content which defeats some of the performance gains from having an Isomorphic app.
IDEALLY I’d have the ability to have a wrapper for whatever view I pass. This wrapper would always be use rendertoString
and the wrapped component would use whatever was set in options (in my case renderToStaticMarkup). This is probably best handled in the options as a config.
Handling it in the options allows overriding it in the reply interface as well - which is very helpful.
an example:
reply.view("myAppComponent", componentPropsObj, {wrapper: myHTMLComponent, wrapperProps: wrapperPropsObj})
Thoughts on if this would be a desired optional feature? It certainly is extremely useful for fully controlled apps.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (12 by maintainers)
Top GitHub Comments
I’ll slap a PR together either way, but thought I should detail the changes.
Resolved in #55