Update to React 18

This commit is contained in:
Angelos Chalaris
2023-04-14 20:32:42 +03:00
parent d0e6a71778
commit 6a2bd3e4af
3 changed files with 8 additions and 5 deletions

View File

@ -33,7 +33,9 @@ const App = () => {
);
};
ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.createRoot(document.getElementById('root')).render(
<App />
);
```
This is a pretty simple React application, with a container, two buttons and a state variable. The problem is it will crash if you click the button that calls `destroyElement()` and then click the other one. _Why?_ you might ask. The issue here might not be immediately obvious, but if you look at your browser console you will notice the following exception: