aem-react-editable-components
aem-react-editable-components copied to clipboard
[bug] NextJS | Lazyloading Components
Describe the bug
I have Header
, Video
, Footer
coming as part of this.childComponents
... Is there a way to lazy load my footer component or have more control on the list of components without breaking in-context editing?
https://github.com/adobe/aem-react-editable-components/blob/d01b307cf6726399ba9a13d2abb37cb2bc004adc/src/components/Page.tsx#L91
Package version ^1.1.6
To Reproduce N/A
Expected behavior
- Would be great if there are some useful examples / documentation around these packages.
Screenshots N/A
Additional context N/A
With NextJS I don't believe we have an example like this currently. We got lazyloading examples currently with react universal component on vanilla react, in our archetype.
This is how I would try to approach it:
Try to leverage custom webpack config to integrate the react universal component somehow in combination with react universal component.
Now, this is a third party plugin, which is not as great as using something OOTB. Once React 18 is released (not in alpha) then we can move into using React.Lazy() which will be better and might actually solve this, provided we can use React.Lazy with NextJS.