How to import a stylesheet from external source in react?
15,881
Solution 1
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';
}
Solution 2
inset the link in your index.html
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
Author by
Gergő Horváth
Updated on September 15, 2022Comments
-
Gergő Horváth over 1 year
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?
-
NIKHIL CHANDRA ROY about 4 yearsIs there any way to import it inside js extension reactjs because I am not using any css file instance use material-ui css
-
Friday Ameh about 4 yearsYou can add it as link to your index.html should work correctly