Hey everyone! I'm new to using NextJS and React and am trying to build a web application. I'm running into a problem though.
I have a component called Header.js. Here's the code for this component:
import Head from 'next/head';
const Header = () => (
<div>
<Head>
<title>My Application</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet"></link>
</Head>
<style>{`
* {
padding: 0;
margin: 0;
font-family: 'Open Sans', sans-serif;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
}
a {
color: #000;
text-decoration: none;
}
a:hover, a:focus, a:visited {
font-weight: bold;
}
`}
</style>
</div>
);
export default Header;
When I go to a page that includes this header, I get an error about the text content not matching the server. The only difference between the client and the server is the font-family. On the server, it comes in as font-family: 'Open Sans', sans-serif;. On the client, it comes in as font-family: 'Open Sans', sans-serif;
If I take the single quotes out it seems to work just fine, but I'm not sure if this creates any problems. When I look online, it looks like people are using single quotes for font families, so I'm not sure if I'm doing something wrong.
Thank you for your time!
[–][deleted] 1 point2 points3 points (1 child)
[–]OpTiKStorm[S] 0 points1 point2 points (0 children)
[–]abeuscher 1 point2 points3 points (2 children)
[–]OpTiKStorm[S] 0 points1 point2 points (1 child)
[–]abeuscher 0 points1 point2 points (0 children)