How can i use google fonts in my react.js application?


I want to use Google fonts in my react.js application, I'm not sure where I should add <link href="https://fonts.googleapis.com/css2?family=Sacramento&display=swap" rel="stylesheet"> and font-family: 'Sacramento', cursive;

1 Answer

4 years ago by

Use any of the below ways, you can add google fonts to your react applicatiom

  1. You can include <link href="https://fonts.googleapis.com/css2?family=Sacramento&display=swap" rel="stylesheet"> in index.html and style using font-family in your code.

  2. You can also import in your css file like :

@import url('https://fonts.googleapis.com/css2?family=Sacramento&display=swap');

and use the font-family to style the required section of code.

h1 {
font-family: 'Sacramento', cursive;
}
4 years ago by Divya