优化代码

This commit is contained in:
none 2023-04-12 11:39:03 +08:00
parent ec32b7a6d1
commit 2a5eab39a6
3 changed files with 2 additions and 26 deletions

View File

@ -23,9 +23,7 @@
"react-redux": "^8.0.5", "react-redux": "^8.0.5",
"react-router-dom": "^6.9.0", "react-router-dom": "^6.9.0",
"redux": "^4.2.1", "redux": "^4.2.1",
"sort-by": "^1.2.0", "sort-by": "^1.2.0"
"web-vitals": "^3.3.0",
"yarn": "^1.22.19"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.0.28", "@types/react": "^18.0.28",

View File

@ -1,8 +1,6 @@
import React from "react";
import ReactDOM from "react-dom/client"; import ReactDOM from "react-dom/client";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
import store from "./store"; import store from "./store";
import reportWebVitals from "./reportWebVitals";
import { BrowserRouter } from "react-router-dom"; import { BrowserRouter } from "react-router-dom";
import { ConfigProvider } from "antd"; import { ConfigProvider } from "antd";
import zhCN from "antd/locale/zh_CN"; import zhCN from "antd/locale/zh_CN";
@ -20,9 +18,4 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
</BrowserRouter> </BrowserRouter>
</ConfigProvider> </ConfigProvider>
</Provider> </Provider>
); );
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

@ -1,15 +0,0 @@
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;