-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
React.lazy has an incorrect type definition #7219
Comments
@bvaughn: Mind helping out here? Is it always meant to render a |
Ah, from the react docs:
The type here is wrong. Your type is right. Want to put up a PR? |
I'd be happy to add this change to my PR if it's easier for everyone. |
@bvaughn yes, go for it :) |
Also, "StatelessFunctionalComponent" seems to be using the old terminology. I guess we can change it to "FunctionComponent", right? |
@alexeyraspopov: Yes, but that's a very disruptive and breaking change. We certainly should change the name, but we should have a codemod ready to go along with the release. |
Summary: Resolves #7219 - [x] 2fdcda5: Removed `React.useMutationEffect` hook (facebook/react/pull/14336) and updated tests. This hook was only ever exposed in an alpha release of 16.7 and so it should be safe to remove in a non-backwards-compatible way. - [x] dabf49e: Add `React.Suspense` component and tests. (No final public documentation exists for `Suspense` yet– although we're working on it. For the time being, [tests like this](https:/facebook/react/blob/master/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js) can serve as a reference.) - [x] 8df05bd: Fixed invalid `useCallback` definition and tests. - [x] 063b022: Fixed invalid `React.lazy` signature to reflect that a `Promise` with a "default" property should be returned (rather than a React component). Pull Request resolved: #7213 Reviewed By: jbrown215 Differential Revision: D13222880 Pulled By: bvaughn fbshipit-source-id: 9e1b48ace984051928c4ab92fa61182ad70f7119
I am getting an error when using React.lazy:
as an example:
Should line be returning a promise instead?
The text was updated successfully, but these errors were encountered: