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.

Element type is invalid error

See original GitHub issue

Do you want to request a feature or report a bug?

  • I found a bug
  • I want to propose a feature

What is the current behavior?

It seems like the plugin not getting imported following the installation guidance React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components) and Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

What I have tried to fix the problem?

I have seen various possible ways to fix it but none of them worked. For example importing like import { Dropzone } from 'react-dropzone' instead of import Dropzone from 'react-dropzone'

But that will not solve the problem. The only way I made it work is by downgrading to version 4.1.3 as someone mentioned before, but thats no use as it has a major bug which crashes the browser as been reported in #549

Please mention other relevant information such as the browser version, Operating System and react-dropzone version.

react-dropzone 4.2.5 Chrome Version 63.0.3239.132 npm 5.6.0 node 6.12.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:30

github_iconTop GitHub Comments

4reactions
hallsbyracommented, Jan 16, 2019

I still have the same problem. But importing like this works:

let Dropzone = require("react-dropzone")
if ("default" in Dropzone) {
    Dropzone = Dropzone.default
}
4reactions
mojadevcommented, Mar 8, 2018

import * as Dropzone from 'react-dropzone';

worked for me

Read more comments on GitHub >

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

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