Browse Source

fix the code block for createRoot typescript error (#4576)

* fix the code block for createRoot typescript error

* added example block code for typescript

* Inline example

Co-authored-by: dan <dan.abramov@gmail.com>
main
Vaskevich Aleksander 3 years ago
committed by GitHub
parent
commit
63234808da
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      content/blog/2022-03-08-react-18-upgrade-guide.md

3
content/blog/2022-03-08-react-18-upgrade-guide.md

@ -40,9 +40,8 @@ render(<App tab="home" />, container);
// After // After
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
const container = document.getElementById('app'); const container = document.getElementById('app');
const root = createRoot(container); const root = createRoot(container); // createRoot(container!) if you use TypeScript
root.render(<App tab="home" />); root.render(<App tab="home" />);
``` ```
We’ve also changed `unmountComponentAtNode` to `root.unmount`: We’ve also changed `unmountComponentAtNode` to `root.unmount`:

Loading…
Cancel
Save