Using theme with Next.js
See original GitHub issueI’m moving a project over from styled-components
and everything has been going super smoothly so far!
I’ve just had some difficulty implementing theming. I used the convention in the useTheme
example, but the props
don’t even seem to be getting defined (I get a “cannot read property ‘theme’ of undefined” error).
Here’s a CodeSandbox example: https://codesandbox.io/s/runtime-browser-zeuw1
It’s probably a silly error on my part, but I can’t seem to figure it out! Any help would be appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Theming in Next.js with styled-components and useDarkMode
To use styled-components in a Next.js app, go into the _app · file, import the ThemeProvider component, and wrap the app with the...
Read more >Implementing Multiple Theme Support in NextJs - Medium
The first step is to create a file theme-options.js in your components folder which would contain variables for all the themes you want...
Read more >Add Theme UI to your NextJS site - DEV Community
1. Install theme-ui · 2. Create and export the theme object · 3. Wrap our NextJS app with Theme UI's ThemeProvider.
Read more >How to Implement Dark/Light Themes in a Next.js App Using ...
In this article, we will Initialize a Next.js application and then implement dark/light theme toggle for it using context hook and TailwindCSS.
Read more >Theme UI – CSS and Styling – Intro to Next.js
theme ui is a library that allows you to create theme objects and use them in your components. It also handles scoping and...
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
Hey @josiahwiebe with the recent PR this got fixed. Checkout your sandbox with the updated version https://codesandbox.io/s/eager-cherry-57c9u.
Will push a new version soon.
@cristianbote - Is it possible to add types so that we can use the
DefaultTheme
insidecreateGlobalStyles
. Currently receivingParameter 'p' implicitly has an 'any' type.ts(7006)
.