Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a stylesheet from external source in react?

Tags:

css

reactjs

I mean icons from fontawesome or fonts from google fonts. In HTML i place something like this in the head:

<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

What about react?

like image 809
Gergő Horváth Avatar asked Jun 27 '18 10:06

Gergő Horváth


2 Answers

You can just import it in your style sheet like so

    @import url('https://fonts.googleapis.com/css?family=Roboto');

And your body style will become

body {
  font-family: 'Roboto';
}
like image 151
Friday Ameh Avatar answered Nov 08 '22 15:11

Friday Ameh


inset the link in your index.html

<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
like image 44
jadlmir Avatar answered Nov 08 '22 16:11

jadlmir