This namespace a helper method for SSR using @loadable/component
import { ChunkExtractor } from "@loadable/server";
import {renderLoadableReduxComponent} from "@quintype/framework/server/render";
import path from "path";
const statsFile = path.resolve("stats.json"); // This is the stats file generated by webpack loadable plugin
const extractor = new ChunkExtractor({ statsFile, entrypoints: ["topbarCriticalCss", "navbarCriticalCss"] }); // We create an extractor from the statsFile
renderLoadableReduxComponent(Header, params.store, extractor)
Methods
# static renderLoadableReduxComponent(Component, store, props, props)
Parameters:
Name | Type | Description |
---|---|---|
Component |
Component
|
The Component to render |
store |
Redux
|
The store to render |
props |
extractor
|
Instance of ChunkExtractor from loadable |
props |
Object
|
The props to pass to the component |