鉴于以下 react 代码:
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import 'typeface-roboto';
import Typography from '@material-ui/core/Typography';
const App = class extends Component {
render() {
return <Typography variant="h1">Hello React App!</Typography>;
}
}
const root = document.getElementById('root');
ReactDOM.render(<App />, root);
如果我评论import 'typeface-roboto';
我的应用程序没有任何变化。
有人可以解释一下为什么吗?
最佳答案
‘typeface-roboto’包用于导入roboto字体,它包括所有必需的字体文件和一个CSS文件。只有当你想更改字体时才需要它。并且,typeface-roboto假设你使用webpack来处理 CSS 和文件。
关于reactjs - Typeface-roboto 的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53020826/