top | item 35187666

(no title)

mtone | 3 years ago

I notice that ReactDOM.render is also deprecated.

In our embedded/plugin component scenario where we are given a <div> to load in, it appears we should replace our current pattern ReactDOM.render(React.createElement(... with createRoot(_jsx(....

discuss

order

danabramov|3 years ago

ReactDOM.render has been deprecated since React 18. If you're running React 18 with ReactDOM.render, you should already see an error urging you to switch because essentially ReactDOM.render works in React 17 mode.

Yeah you want

const root = createRoot(domNode) root.render(<Stuff />)

(or the JSX transform output equivalent)

mtone|3 years ago

We're not on 18 yet but things are clear, thanks!