Invariant Violation: Element type is invalid: expected a string( for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in.
See original GitHub issueIs this a bug report?
yes App.js.txt User_List.php.txt
Have you read the Contributing Guidelines?
(Write your answer here.)
Environment
Steps to Reproduce
(Write your steps here:)
Expected Behavior
(Write what you thought would happen.)
Actual Behavior
(Write what happened. Add screenshots!)
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Issue Analytics
- State:
- Created 6 years ago
- Comments:65 (2 by maintainers)
Top Results From Across the Web
Invariant Violation: Element type is invalid: expected a string ...
You likely forgot to export your component from the file it's defined in. ... a string (for built-in components) or a class/function but...
Read more >Element type is invalid: expected a string (for built-in ... - GitHub
I export and import default connect ed stateless functional components in the usual way. -- Actually the component which use causes the error...
Read more >Element type is invalid: expected a string (for ... - OneCompiler
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to ......
Read more >Element type is invalid: expected a string (for built-in ...
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. edit.js :
Read more >Error: Element type is invalid: expected a string (for ... - YouTube
You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports....
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
I answer my own question. The fix is fairly simple. Open
App.js
file and modify this lineclass YourApp extends Component {
intoexport default class YourApp extends Component<{}> {
Hi smithaitufe, You are having the issue because you are probably exporting addNewTask as default and you importing it as named export. So change import {addNewTask} from ‘…/actions’; to import addNewTask from ‘…/actions’;