schiehll / react-alert

alerts for React
MIT License
608 stars 98 forks source link

Attempted import error: 'useAlert' is not exported from 'react-alert' #106

Closed Pradnyana28 closed 5 years ago

Pradnyana28 commented 5 years ago

I'm trying to import useAlert hook but get an unexpected output.

index.js `import { Provider as AlertProvider } from 'react-alert' import AlertTemplate from 'react-alert-template-basic'

Ooops, error brohh!
}>
` somewhere.js `import { useAlert } from 'react-alert' const login = () => { const alert = useAlert() alert.show('err') }` Is there something wrong or any typo in my code ? thank you.
schiehll commented 5 years ago

Hey @Pradnyana28 what version of the lib are you using? useAlert was introduced in v5, so if you are using v5 you should be good.

If that's the case, can you reproduce it in a codesandbox? Without seeing the code it's hard to help.

Pradnyana28 commented 5 years ago

I see, maybe i need to read the docs carefully 👍

littlefroginnovations commented 5 years ago

I am having this same issue with 5.5.0

vincenttern commented 4 years ago

Im having the same issue with version 6 and 5.5, i have react version 16.9

littlefroginnovations commented 4 years ago

as you can see from separate issues posted about this they are not interested in fixing. I even posted my own issue and documented it but because i didnt post with example code they marked it as false bug and closed the issue. there are better packages out there for alert. Check out react-redux-toastr its a way better package

besLisbeth commented 4 years ago

I just checked out that everything works with

"react": "^16.12.0",
"react-alert": "^6.0.0"

Unfortunately, nothing can be done without the full example code or working sandbox.