Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update templates to use React 18 createRoot #12220

Merged
merged 1 commit into from
Apr 8, 2022

Conversation

kyletsang
Copy link
Contributor

Fixes #12219

Since CRA installs React 18 by default now, we should update the template to use the new createRoot

@facebook-github-bot
Copy link

Hi @kyletsang!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@kyletsang kyletsang changed the title Update templates to use createRoot Update templates to use React 18 createRoot Apr 1, 2022
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
const root = ReactDOM.createRoot(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im also getting warnings in the default app.test.js file since it uses the render method from react testing library. Not sure if that needs a similar fix but in case you know better than i do i thought i'd point it out. Thanks so much for this PR i think it'll be really crucial going forward

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jbenjoy2, the RTL changes will be done with #12223

@rickhanlonii
Copy link
Member

Hey just checking in, what's blocking this?

@kyletsang
Copy link
Contributor Author

Friendly ping @iansu and @mrmckeb. This PR is ready to merge.

@iansu
Copy link
Contributor

iansu commented Apr 8, 2022

Now that the TypeScript types for React 18 are out nothing is blocking this. Does this need to be merged along with #12223?

@kyletsang
Copy link
Contributor Author

Now that the TypeScript types for React 18 are out nothing is blocking this. Does this need to be merged along with #12223?

Yes, the RTL update should also be merged for react 18 compatibility.

Thanks!

@iansu
Copy link
Contributor

iansu commented Apr 8, 2022

@kyletsang I merged the RTL PR. Do you mind updating this branch from main so we can re-run the tests?

@iansu iansu added this to the 5.0.1 milestone Apr 8, 2022
@kyletsang
Copy link
Contributor Author

@iansu done!

@iansu iansu merged commit 2eef1d0 into facebook:main Apr 8, 2022
@iansu
Copy link
Contributor

iansu commented Apr 8, 2022

Thanks!

@kyletsang kyletsang deleted the update-reactdom-render branch April 8, 2022 22:05
@void0err
Copy link

At which version, is this going to fix?

As far today(April 10th, 2022), the npx create-react-app doesn't pickup this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Browser console warning about React 18 and ReactDOM.render
6 participants