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;
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 addingmodule.exports = Toggle;
to index.js.