Per-page layouts are not rendering
See original GitHub issueI’m using per-page layouts as described here https://nextjs.org/docs/basic-features/layouts#per-page-layouts and when I use them with next-translate the layout is not rendering. Can I get some help? Thank you very much
nextJS version: 11.1.2 and 12.0.1 (tried both) next-translate version: 1.1.1
// Layout.tsx
export const Layout = ({ children }: PropsWithChildren<unknown>): JSX.Element => {
return (
<main>
{children}
</main>
);
};
// index.tsx
import { Layout } from '@components';
const Home = (): JSX.Element => {
const { t } = useTranslation();
return (
<div>
{t('home:description')}
</div>
);
};
Home.getLayout = (page: PageProps) => <Layout>{page}</Layout>;
export default Home;
// _app.tsx
function MyApp({ Component, pageProps }: Props): JSX.Element {
const getLayout = Component.getLayout || ((page) => page);
return getLayout(
<>
<CssBaseline />
<Component {...pageProps} />
</>
);
}
export default MyApp;
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Per-page layouts are not rendering · Issue #717 - GitHub
I'm using per-page layouts as described here https://nextjs.org/docs/basic-features/layouts#per-page-layouts and when I use them with ...
Read more >NextJS Layout component not rendering page content [closed]
This "should" render my different page content and Menu/Footer should be visible on every page I create. I can see the Menu/Footer on...
Read more >Fields Are Not Visible on a New Page Layout for Certain Users
Fields Are Not Visible on a New Page Layout for Certain Users · Select the name of the user · Click Profile ·...
Read more >Basic Features: Layouts - Next.js
Learn how to share components and state between Next.js pages with Layouts.
Read more >Embedded VF Page Not Rendering on Page Layout
I am having an issue with the dynamic pick list field displaying on the Account page when I add it to the page...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @aralroca for this solution!
no problem, we all make mistakes ! I’m glad it’s working for you then. I close the issue
It’s good that you do it this way, it doesn’t take up that much
hoist-non-react-statics(1.2kb) and it’s used by most libraries that use HOC to copy everything.