Skip to content

Instantly share code, notes, and snippets.

@wontondon
Last active November 2, 2022 18:52
Show Gist options
  • Save wontondon/27ccacb2bd59c3fe9265460e6c96c1d1 to your computer and use it in GitHub Desktop.
Save wontondon/27ccacb2bd59c3fe9265460e6c96c1d1 to your computer and use it in GitHub Desktop.
Sample Next 13 w/ Chakra context
'use client';
import React, { useState } from 'react';
import { ChakraProvider } from '@chakra-ui/react';
import { theme } from './theme';
export default function ContextProviders({
children,
}: {
children: React.ReactNode;
}) {
return (
<ChakraProvider theme={theme}>
{children}
</ChakraProvider>
);
}
import ContextProviders from './context-providers';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<ContextProviders>{children}</ContextProviders>
</body>
</html>
);
}
'use client';
import { Box } from '@chakra-ui/react';
export default function Home() {
return <Box bg="red.100">Example</Box>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment