diff --git a/content/docs/conditional-rendering.md b/content/docs/conditional-rendering.md index 8a6763d7..d8c01b1e 100644 --- a/content/docs/conditional-rendering.md +++ b/content/docs/conditional-rendering.md @@ -35,11 +35,9 @@ function Greeting(props) { return ; } -ReactDOM.render( - // Try changing to isLoggedIn={true}: - , - document.getElementById('root') -); +const root = ReactDOM.createRoot(document.getElementById('root')); +// Try changing to isLoggedIn={true}: +root.render(); ``` [**Try it on CodePen**](https://codepen.io/gaearon/pen/ZpVxNq?editors=0011) @@ -110,10 +108,8 @@ class LoginControl extends React.Component { } } -ReactDOM.render( - , - document.getElementById('root') -); +const root = ReactDOM.createRoot(document.getElementById('root')); +root.render(); ``` [**Try it on CodePen**](https://codepen.io/gaearon/pen/QKzAgB?editors=0010) @@ -140,10 +136,9 @@ function Mailbox(props) { } const messages = ['React', 'Re: React', 'Re:Re: React']; -ReactDOM.render( - , - document.getElementById('root') -); + +const root = ReactDOM.createRoot(document.getElementById('root')); +root.render(); ``` [**Try it on CodePen**](https://codepen.io/gaearon/pen/ozJddz?editors=0010) @@ -244,10 +239,8 @@ class Page extends React.Component { } } -ReactDOM.render( - , - document.getElementById('root') -); +const root = ReactDOM.createRoot(document.getElementById('root')); +root.render(); ``` [**Try it on CodePen**](https://codepen.io/gaearon/pen/Xjoqwm?editors=0010)