- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
来自 this section , create-react-app
说过:
By default, Create React App includes a performance relayer thatallows you to measure and analyze the performance of your applicationusing different metrics.
To measure any of the supported metrics, you only need to pass afunction into the reportWebVitals function in index.js:
reportWebVitals(console.log);
This function is fired when the finalvalues for any of the metrics have finished calculating on the page.You can use it to log any of the results to the console or send to aparticular endpoint.
index.js
中时,我有一个错误:
'reportWebVitals' is not defined
index.js
来源:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
<Provider>
<App/>
</Provider>,
document.getElementById('root')
);
reportWebVitals(console.log);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit .ly/CRA-PWA
serviceWorker.unregister();
最佳答案
我发现 reportWebVitals
存在于 create-react-app
的新版本中(4.0.0)。所以为了使用reportWebVitals
, 我创建了新的 create-react-app
并复制 reportWebVitals.js
进入我的项目,它奏效了。
关于create-react-app - 'reportWebVitals' 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64941176/
开箱即用 npx create-react-app app-name --template typescript 生成以下内容: 我似乎找不到任何关于此预期返回类型的信息。大家有什么想法吗? 最佳答案
来自 this section , create-react-app说过: By default, Create React App includes a performance relayer th
我是一名优秀的程序员,十分优秀!