title: Nextjs switch body background color
body: <p>I'm trying to make a button to change the background in Nextjs. Why this doesn't work?</p>
  <p><code>_app.js</code></p>
  <pre><code>import '../styles/global.css'
  import { AppProps } from 'next/app'
  import { useState } from 'react'
  
  
  export default function App({ Component, pageProps }: AppProps) {
    const [isDark, setIsDark] = useState(false)
    
    return (
      &lt;&gt;
        &lt;Component {...pageProps} /&gt;
        &lt;style jsx global&gt;{`
          ${ isDark ? 'body {background: darkslategray;}' : 'body {background: antiquewhite;}' }
        `}&lt;/style&gt;
      &lt;/&gt;
    )
  }
  </code></pre>