How do I include fonts as part of the bundling for a react npm package?

Asked 2 years ago

I'm relatively new to React, and I'm working on a website for my friend (it's a cryptocurrency tracker). I'd like to use a custom font, but I'm having a hard time importing it. Any ideas?

Ellis Callahan

Wednesday, October 05, 2022

There are multiple ways to import a custom font in React, but the easiest one is probably through a custom css file. Just create custom .css file called customFonts.css, and use "@import url("....")" linking to the font's link. Then, just type in in the command import "./assets/styles/customFonts.css" in your main file.

Write an answer...


Please follow our  Community Guidelines

Can't find what you're looking for?