I have a parent component A, creating a child component B. This child component's definition is imported using Loadable. In the following, component B is the Catalog.
Now I want to fetch some initial data before rendering this component, as it is described in the doc. Here's what I have :
const Catalog = Loadable.Map({
loader: {
Catalog: () => import('./Catalog'),
initialData: () => fetchCatalogInitialData(foo1, foo2),
},
loading: () => {return <div>foo</div>},
render(loaded, props) {
let Catalog = loaded.Catalog.default;
let initialData = loaded.initialData;
return <Catalog {...props} initialData={initialData} />;
},
});
I'd like fetchCatalogInitialData
to be called with parameters, i.e a URL, a token, etc. Is this doable in a nice way?