reactpy-django
reactpy-django copied to clipboard
Use `ReactDOM.createRoot` instead of `ReactDOM.render`
Description
ReactDOM.render is deprecated as of React 18 (see here), and removed in React 19 (see here). This switches to the alternative, ReactDOM.createRoot(...).render(<Root />).
Checklist
Please update this checklist as you complete each item:
- [x] Tests have been developed for bug fixes or new functionality.
- [x] The changelog has been updated, if necessary.
- [x] Documentation has been updated, if necessary.
- [x] GitHub Issues closed by this PR have been linked.
By submitting this pull request I agree that all contributions comply with this project's open source license(s).
Looks like this change broke the testing suite.
Maybe the ReactJS version needs to be bumped to support this?
Could be, but looking at the package lock, it seems to be in React 17, so it should support this. I'm not sure how the testing suite it set up, but createRoot supposedly takes control of the DOM node somehow. Perhaps that's screwing things up?
Scratch that - createRoot was added in React 18, not 17, so yeah, it's the version.
Closing in favor of #285