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

Migrate to import * as React from 'react' #620

Closed

Conversation

kodai3
Copy link

@kodai3 kodai3 commented Aug 15, 2020

- import React from 'react'
+ import * as React from 'react'

reference
facebook/react#18102
mui/material-ui#19802

@caleb-harrelson
Copy link
Collaborator

At what version of React does this become required? I don't see anything about this listed as a breaking change for v17 and this comment seems to indicate it won't affect ES Module imports like we have here, just CommonJS requires.

@kodai3
Copy link
Author

kodai3 commented Aug 20, 2020

I could not find at what version facebook/react#18106 released, but named export is released some where at v16.x.
v16.13.1 already has no default export, so default exporting is already not technically correct.
https://github.com/facebook/react/blob/v16.13.1/packages/react/src/React.js

My understanding is bundlers make default export work on ESM(separate entry points), so the change did not affect ESM, but "will" do with transition period.

facebook/react#18102 (comment)

@atnpcg
Copy link

atnpcg commented Sep 24, 2020

I haven't seen anywhere on react that default export is not longer available.
all of their docs they still use
import React from 'react'

@caleb-harrelson
Copy link
Collaborator

Closing this as unnecessary until we see more documentation about it being required.

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.

3 participants