I'm using a google font in my react project, and whenever I open up my site, there is a very noticeable split second where my text that uses the font initially loads with a seemingly different font, then changes to the correct font right after.
What is happening here? And how do I prevent this from happening?
Loading font in public/index.html
<link
href="https://fonts.googleapis.com/css2family=Bebas+Neue&display=swap"
rel="stylesheet"
/>
adding the font to a class in src/index.css
.bg-header {
font-family: "Bebas Neue", sans-serif;
color: darkorange;
text-decoration: underline;
position: absolute;
bottom: 10%;
left: 5%;
font-size: 75px;
}
html tag in react component
<h5 className="bg-header">{getHeader()}</h5>