Created
August 3, 2023 07:37
-
-
Save chriship/d564edffd73d4b091ed8a59beff923d0 to your computer and use it in GitHub Desktop.
nextjs Head order bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tailwind base; | |
@tailwind components; | |
@tailwind utilities; | |
body { | |
background-color: green; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Head from 'next/head' | |
function TestComponent({ }) { | |
return ( | |
<> | |
<Head> | |
<style>{` | |
body { | |
background-color: blue; | |
} | |
`}</style> | |
</Head> | |
<div></div> | |
</> | |
) | |
} | |
export default function Home() { | |
return ( | |
<> | |
<Head> | |
<style>{` | |
body { | |
background-color: red; | |
} | |
`}</style> | |
</Head> | |
<div> | |
<TestComponent /> | |
<div>I would expect 'TestComponent' to override the background color but the one from globals.css is prioritized but it rendering green from globals.css</div> | |
</div> | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment