Added the possibility to use renderType as a function. This enables apps to determine at runtime if they should use e.g., hydrate or render which does change for some applications (for example server-side rendered ones).
Setting hydrate as a constant for SSR apps produce a bug whenever the users entry-point to the site is not server-side rendered, as normal routing towards this app will not hit the server and the DOM will not have SSR content when the app bootstraps, which in turn produces an error message similar to this when reactdom.hydrate() is called (taken from isomorphic.microfrontends.app):
Warning: Expected server HTML to contain a matching <div> in <div>.
in div (created by Pr)
in Pr (created by _r)
in t (created by t)
in t (created by _r)
in _r (created by rootComponent)
in Ar (created by rootComponent)
in ze (created by rootComponent)
in O (created by rootComponent)
in rootComponent
When used as a function, the renderType can be used for example like this, where it would let the developers decide when and if it should hydrate or render:
Added the possibility to use
renderType
as a function. This enables apps to determine at runtime if they should use e.g.,hydrate
orrender
which does change for some applications (for example server-side rendered ones). Settinghydrate
as a constant for SSR apps produce a bug whenever the users entry-point to the site is not server-side rendered, as normal routing towards this app will not hit the server and the DOM will not have SSR content when the app bootstraps, which in turn produces an error message similar to this when reactdom.hydrate() is called (taken from isomorphic.microfrontends.app):When used as a function, the renderType can be used for example like this, where it would let the developers decide when and if it should
hydrate
orrender
:Also added
render
as a possible ENUM value as stated in the docs https://single-spa.js.org/docs/ecosystem-react/#options and fixed a small typo