This introduces a componentLoader and childProps prop to RootElement. componentLoader takes in an asynchronous function that resolves to a component. RootElement will pause on rendering until componentLoader has been resolved. Using this with dynamic code loaders such as require.ensure or import() can result in having server side rendered sections without having to download the client side Javascript until later in the page loading process.
childProps will be additional props that can be passed to the resolved component. childProps are mainly used for sending down synchronous props. It's usage is not restricted to componentLoader and can be used with out it.
This introduces a
componentLoader
andchildProps
prop toRootElement
.componentLoader
takes in an asynchronous function that resolves to a component.RootElement
will pause on rendering untilcomponentLoader
has been resolved. Using this with dynamic code loaders such asrequire.ensure
orimport()
can result in having server side rendered sections without having to download the client side Javascript until later in the page loading process.childProps
will be additional props that can be passed to the resolved component.childProps
are mainly used for sending down synchronous props. It's usage is not restricted tocomponentLoader
and can be used with out it.Examples and more detailed descriptions can be found under https://github.com/davidk107/react-server/tree/add-componentLoader-support/packages/react-server-examples/code-splitting