react-toggle icon indicating copy to clipboard operation
react-toggle copied to clipboard

CommonJS import error

Open hugoalvarado opened this issue 8 years ago • 1 comments

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.

hugoalvarado avatar Mar 26 '17 05:03 hugoalvarado

+1

benpptung avatar Oct 02 '17 19:10 benpptung