Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommonJS import error #97

Open
hugoalvarado opened this issue Mar 26, 2017 · 1 comment
Open

CommonJS import error #97

hugoalvarado opened this issue Mar 26, 2017 · 1 comment

Comments

@hugoalvarado
Copy link

Hello,

I followed the guide and attempted to use the CommonJS import:
const Toggle = require('react-toggle')

And got these 2 errors:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of StatelessComponent.

Which could be resolved by changing the import:
const Toggle = require('react-toggle').default
or adding
module.exports = Toggle;

to index.js.

@benpptung
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants