Answer the question
In order to leave comments, you need to log in
How to make a good template engine?
Hello everyone
, I started to slowly learn React to write a small project, the following question arose: I have a header, a footer, there are n (let it be 5) links for navigating the site, while the content on each page is different, but the style, footer, header , logo and other goodies are the same. Duck, please tell me the best practice of organizing a template engine on react to generate pages
Answer the question
In order to leave comments, you need to log in
If the layout is the same on every route:
render() {
return(
<Wrapper>
<Header />
<Main />
<Footer />
</Wrapper>
);
}
const MainPageLayout = ({ children }) => (
<Wrapper>
<Header />
<PageContent>
{children}
</PageContent>
<Footer />
</Wrapper>
);
const SomePage = () => (
<MainPageLayout>
{/* page code */}
</MainPageLayout>
);
<Provider>
<Router>
<App />
</Router>
</Provider>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question