DeloitteAU / react-habitat

⚛️ 🛅 A React DOM Bootstrapper designed to harmonise a hybrid 'CMS + React' application.
Other
261 stars 42 forks source link

Any Ideas for a universal/isomorphic app approach #16

Open jirgn opened 7 years ago

jirgn commented 7 years ago

I'm looking forward of using react-habitat for integrating multiple react component into an cms base site. It would be really cool, if this components can be rendered serverside and initialized/registred later on. This would really help to address issues of page rendering speed as well as seo requirements. Did you already figure out a way to integrate react-habitat with ReactDomServer?

jennasalau commented 7 years ago

Hi jirgn,

Glad you're looking forward to using it! Let us know how you go..

As for server side rendering, that is something that hasn't come up before. You definitely have my attention! I'm just having trouble seeing what they may look like in this library.

It may have to be a small restructure of this library + a number of other server side libraries (unless we go node only?).

Is coming up with a solution something you would be interested in getting involved in?

As for ReactDomServer, react-habitat will work as expected on the client side no problem.. but as above, there has been no server side testing.

jirgn commented 7 years ago

Hey Jenna, thanx for the info and sorry I did not respond last time. When thinking about a proper way to do server side rendering, i come up with 3 different ideas, how how to setup.

I want the application

To explain why, I try to give you an idea, what the scope of my current project is, and where habitat plays its role.

I build a client-side search application, that splits up in different components for

These components are parameterised and placed in a cms system (neos.io in my case) clean an simple with react-habitat. Furthermore the hole application needs to be configured via the cms (backendUrl, itemsPerPage ...). When initialised , the client-side app calls a Solr backend and updates asynchronously via redux + saga. Last but not least I also make use of get params so that the filter-state of the app is bookmarkable.

The first two ideas i came up with expect to run on the server like on the client with intializing the components via habitat. to make this happen i would expect habitat to have

Idea 1

CMS delegates the page-payload to nodejs server via curl. the server (e.g. express) makes use of react-habitat to build up the full site. For an Overview see full_page.png "fullPage - CMS can not pass Data onPostRender"

pro:

contra:

question:

opinion:

Idea 2

Controller script before CMS entry point, that interprets the cms response and then delegates to a nodejs for pre-render. For an Overview see full_page.png "fullPage - CMS can pass Data onPostRender"

pro:

contra:

opinion:

idea 3

CMS delegates modulewise to the pre-render nodejs, that renders only one component. For an Overview see module_wise.png

pro:

service

contra:

opinion:

full_page module_wise

jennasalau commented 7 years ago

Hi jirgn,

Thanks for the incredibly detailed analysis and solution suggestions. Legend!!

We have a sizable release going out very soon (pending beta testing) and I would like to concentrate efforts on supporting server side rendering next.

Given that work on this feature will start in the near future, is this something you are interested in contributing development time too? (No pressure, just asking incase you want to be involved right through) Your pre-work certainly gives us a massive head start and I will take it to our internal team for opinions on approach.

olafur164 commented 5 years ago

@jennasalau Has any work been put into this?

jennasalau commented 5 years ago

Hi @olafur164 not yet.. I'm not getting much spare time to pick something as big as this up. Feel free to tackle it if you want. Keep in mind we have lots of updates staged on the develop branch and it would be a better choice to branch from.