You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.
importReact,{Component}from"react"import{Route}from"react-router"importAppContainerfrom"../components/AppContainer"importPhenomicPageContainerfrom"phenomic/lib/PageContainer"/* ! HERE IS THE TRICK */constreqLayouts=require.context("../layouts",true,/\/index\.js$/)constlayouts=reqLayouts.keys().reduce((layouts,layout)=>({
...layouts,[layout.replace("./","").replace("/index.js","")]:
reqLayouts(layout).default,}),{})/* ! */classPageContainerextendsComponent{render(){const{ props }=thisreturn(<PhenomicPageContainer{ ...props}layouts={layouts}/>)}}exportdefault(<Routecomponent={AppContainer}><Routepath="*"component={PageContainer}/></Route>)
We should add this in the default theme and also try to reduce this code, maybe using a function that accept the "reqLayouts". An issue might be the context that will be used for the require (same thing as the hot reload for markdown...)
The text was updated successfully, but these errors were encountered:
We could highly recommend, but nothing should be mandatory. Especially file tree, which is likely to be adjusted depending on the need, context, legacy etc...
But I am not even sure that with this restriction, the problem will go away. The require.context usage can be very tricky from my previous tests (for markdown hot loading).
Easy!
We should add this in the default theme and also try to reduce this code, maybe using a function that accept the "reqLayouts". An issue might be the context that will be used for the require (same thing as the hot reload for markdown...)
The text was updated successfully, but these errors were encountered: