reactive-python / reactpy-django

It's React, but in Python. Now with Django integration.
https://reactive-python.github.io/reactpy-django/
MIT License
322 stars 18 forks source link

Use `ReactDOM.createRoot` instead of `ReactDOM.render` #238

Open ZeroIntensity opened 2 months ago

ZeroIntensity commented 2 months ago

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:

By submitting this pull request I agree that all contributions comply with this project's open source license(s).

Archmonger commented 2 months ago

Looks like this change broke the testing suite.

Maybe the ReactJS version needs to be bumped to support this?

ZeroIntensity commented 2 months ago

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?

ZeroIntensity commented 2 months ago

Scratch that - createRoot was added in React 18, not 17, so yeah, it's the version.