CodeNewbie Community 🌱

Mette Vorraa
Mette Vorraa

Posted on

How to add google font to react?

How to add google font to react app?

I have seen lots of advice online, but the methods result in errors in web inspect console.

Here's what I've got in css file:

@import url('');
body {
font-family: 'Kumbh Sans', sans-serif;

Errors in console:
Access to script at '' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.


Uncaught (in promise) TypeError: Failed to fetch dynamically imported module:

Thank you thank you!

Latest comments (2)

terabytetiger profile image
Tyler V. (he/him)

CORS is always the worst kind of error - essentially your localhost page isn't recognized as allowed to communicate with Google Fonts for one reason or another.

I would start by looking through the responses here and see if any of the solutions from others sound like they might be your situation:

I am using Google Webfonts on my website. In the console on Chrome I get the following warning:

Blink is considering rejecting non spec-compliant cross-origin web font requests: Please use Access-Control-Allow-Origin to make these requests spec-compliant.

Upon inspecting the request headers there appears to not be any Access-Control…

It looks like your CSS is correct though - I would guess the issue is something outside of your CSS file.

hannaali profile image

You discover free fonts with different styles discover right at