Reputation: 16587
I am working on a simple app in react with ES6 and babel. Recently I faced this issue. I used react-notifications
package here: https://github.com/minhtranite/react-notifications
I just followed the docs and it works fine. I can import it with import {NotificationContainer, NotificationManager} from 'react-notifications';
But then I tried to work with this: https://github.com/cezary/react-loading
Now in the example of react-loading, the developer isn't using the ES6 way to get the component. I tried to look at the JS file and tried this after doing npm install react-loading
:
import {Loading} from 'react-loading';
but somehow this doesn't work. I get this:
You likely forgot to export your component from the file it's defined in
But I can see it is exported. What am I doing wrong?
Upvotes: 0
Views: 203
Reputation: 1339
Since it is a single module, it is exported as default. You'll have to do this:
import Loading from 'react-loading';
Upvotes: 3