Invalid element type
See original GitHub issue💬 Questions and Help
I am currently adding loadable-components in an SSR project. I got the below warning and the lazy component is not loaded
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: symbol.
Check the render method of `RouterContext`.
in RouterContext (created by Router)
in Router
in Provider
in HelmetProvider
in ApolloProvider
in ErrorBoundary
I suspect it is the same reason as #310 because I am currently using react-router v3, but not sure if there is a workaround for so?
Below is my route config
{
path: 'about(/)',
getComponent: loadable(() => import('./containers/AboutPage')),
},
Client babel config:
{
presets: [
[
'@babel/preset-env',
{
'targets': {
browsers: [
'last 2 versions',
'safari >= 7',
'ie >= 9',
],
},
'useBuiltIns': 'usage',
'corejs': '3.6',
'modules': false,
},
],
'@babel/preset-react',
'@babel/preset-flow',
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-optional-chaining',
'@emotion',
'@loadable',
]
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
Invariant Violation: Element type is invalid: expected a string ...
This error can rise if you try to import a non-existent component. Make sure you have no typo and that the component indeed...
Read more >(React) Element type is invalid, expected a string (for built in ...
To solve the error "Element type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got", ......
Read more >Element type is invalid: expected a string (for built-in ... - GitHub
The app breaks and gives this error message: Element type is invalid: expected a string (for built-in components) or a class/function (for ...
Read more >Element type is invalid: expected a string (for built-in ... - Reddit
Getting Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ...
Read more >Server Error Error: Element type is invalid: expected a string ...
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
routes.js file below
But when I change file extension from
routes.js
toroute.ts
it doesn’t work.BUT you are right
routes.tsx
works VERY FINE !!! many thanks@theKashey @IniZio Do we still have to use this workaround ?
I am on
react
17 andreact-router
5 Because I have been trying without and it’s all good. Can you confirm please ? Cheers.