react-simple-dropdown: Cannot load application after upgrade from 0.1.1 -> 1.0.1

I receive the following error when loading up my React application when using 1.0.1:

Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method oft.

I didn’t change any of my JSX, simply just upgraded the package. Any help on this would be greatly appreciated.

Thanks

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 30 (10 by maintainers)

Most upvoted comments

Here’s an alternative to @davinchia’s solution:

var SimpleDropdown = require('react-simple-dropdown');
var Dropdown = SimpleDropdown.default;
var DropdownTrigger = SimpleDropdown.DropdownTrigger;
var DropdownContent = SimpleDropdown.DropdownContent;

Received the same error. It was fixed when I used

import Dropdown, { DropdownTrigger, DropdownContent } from ‘react-simple-dropdown’;

instead of

var Dropdown = require(‘react-simple-dropdown’); var DropdownTrigger = Dropdown.DropdownTrigger; var DropdownContent = Dropdown.DropdownContent;

as on the README.

Not sure why…

i’m using version 1.1.2 with webpack with babel and ran into a similar/the same problem with ES6 import. the module names appeared to be wrong. to get around this, i used:

import { default as Dropdown, DropdownContent, DropdownTrigger } from "react-simple-dropdown";