如何在反应中从外部源导入样式表?

Ger*_*áth 8 css reactjs

我的意思是来自 fontawesome 的图标或来自谷歌字体的字体。在 HTML 中,我在头部放置了这样的东西:

<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)

反应过来呢?

Fri*_*meh 15

你可以像这样在你的样式表中导入它

    @import url('https://fonts.googleapis.com/css?family=Roboto');
Run Code Online (Sandbox Code Playgroud)

你的体型会变成

body {
  font-family: 'Roboto';
}
Run Code Online (Sandbox Code Playgroud)