schiehll / react-alert

alerts for React
MIT License
607 stars 99 forks source link

Everything inside Provider disappears #66

Closed kartik0709 closed 6 years ago

kartik0709 commented 6 years ago

If I'm at the homepage and if I press the link to the homepage twice, everything inside the provider disappears.

schiehll commented 6 years ago

@kartik0709, sorry, but you will have to explain better what's happening. Show us some minimal way of reproduce it. You can fork this codesandbox and try to reproduce the problem, then paste the link here so we can help you.

kartik0709 commented 6 years ago

Sure. Here you go - https://codesandbox.io/s/8k35mww060 When we click on Home, the entire body inside AlertProvider disappears.

schiehll commented 6 years ago

Thank you!

So here's the problem: you have to put the AlertProvider in your root component, in this case the index.js file.

Here: https://codesandbox.io/s/p58lwy3kvx

Hope it helps.

kartik0709 commented 6 years ago

Oh, thanks a lot! Can you mention this in the guide too? so no-one else makes the same mistake.