question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Is this a bug report?

yes screenshot_2017-10-12-14-03-09-58 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:closed
  • Created 6 years ago
  • Comments:65 (2 by maintainers)

github_iconTop GitHub Comments

156reactions
simoarpecommented, Oct 16, 2017

I answer my own question. The fix is fairly simple. Open App.js file and modify this line class YourApp extends Component { into export default class YourApp extends Component<{}> {

95reactions
Guy-Leumicommented, Feb 25, 2018

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’;

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found