-
-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`resolveComponent` is a synchronous function to resolve the react component from the imported module and props. Unlike wrappers on the import function itself, it works on both the client and server side.
- Loading branch information
1 parent
9e00f2e
commit a47d3d9
Showing
8 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
import hoistNonReactStatics from 'hoist-non-react-statics' | ||
|
||
export function resolveComponent(loadedModule, { Loadable }) { | ||
export function defaultResolveComponent(loadedModule) { | ||
// eslint-disable-next-line no-underscore-dangle | ||
const Component = loadedModule.__esModule | ||
? loadedModule.default | ||
: loadedModule.default || loadedModule | ||
hoistNonReactStatics(Loadable, Component, { | ||
preload: true, | ||
}) | ||
return Component | ||
return loadedModule.__esModule | ||
? loadedModule.default | ||
: loadedModule.default || loadedModule | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters