Skip to content

Commit 3e72612

Browse files
committed
Update deprecated code
1 parent ced596c commit 3e72612

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
55
import reportWebVitals from './reportWebVitals';
66

7-
ReactDOM.render(
7+
const root = ReactDOM.createRoot(document.getElementById('root'));
8+
root.render(
89
<React.StrictMode>
910
<App />
10-
</React.StrictMode>,
11-
document.getElementById('root')
11+
</React.StrictMode>
1212
);
1313

1414
// If you want to start measuring performance in your app, pass a function

src/reportWebVitals.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const reportWebVitals = onPerfEntry => {
22
if (onPerfEntry && onPerfEntry instanceof Function) {
3-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4-
getCLS(onPerfEntry);
5-
getFID(onPerfEntry);
6-
getFCP(onPerfEntry);
7-
getLCP(onPerfEntry);
8-
getTTFB(onPerfEntry);
3+
import('web-vitals').then(({ onCLS, onFID, onFCP, onLCP, onTTFB }) => {
4+
onCLS(onPerfEntry);
5+
onFID(onPerfEntry);
6+
onFCP(onPerfEntry);
7+
onLCP(onPerfEntry);
8+
onTTFB(onPerfEntry);
99
});
1010
}
1111
};

0 commit comments

Comments
 (0)