Code is all webpacked to hell, so check out https://github.com/elifitch/3december-2017/tree/master/dec-8 for the source if you wanna have a peek.
A Pen by Konstantin Denerz on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useMemo } from 'react' | |
| import { injectScript } from '@module-federation/utilities' | |
| import dynamic from 'next/dynamic' | |
| // TODO: replace with a LRU cache or something similar | |
| const remotePagesMap = new Map(); | |
| function DynamicComponent({ remote, path, props }) { | |
| const Component = useMemo(() => { | |
| if (typeof window === 'undefined') { |