schiehll / react-alert

alerts for React
MIT License
607 stars 99 forks source link

Upgrading from v4.0.4 to v5.2.0 Breaks App #111

Closed jkhaui closed 5 years ago

jkhaui commented 5 years ago

Hi,

I would try to give you more info, but to be honest I don't even know where to look for the issue. After upgrading to the React Hooks version of react-alert, my entire app is broken. All I get in the console is an error saying "index.js:1446 Warning: Functions are not valid as a React child. This may happen if you return a Component instead of from render..." in Unknown (at src/index.js:22) in Provider (at src/index.js:21) in Root (at src/index.js:28)

This happens even after I've removed all instances and imports of react-alert in my app components. All that remains is the v5.2.0 package. Any ideas what might be causing this?

besLisbeth commented 5 years ago

Hi, @jkhaui. Unfortunately, without code, it's hard to understand what caused an error. Can you please post an error chain here or somewhere at the sandbox?

schiehll commented 5 years ago

@jkhaui if you are using withAlert, in v5 you have to add and extra (), like: withAlert()(YourComponent).

If that don't solve it, feel free to ask me to reopen it.

jkhaui commented 5 years ago

@besLisbeth @schiehll thank you for your swift replies. I have fixed the issue. For anyone who might stumble upon this thread, I think the issue was caused by not including the extra () in my app.js file, as has been stated.

Note that I'd spent ages checking the () was present in the components imported by app.js (ie the components actually creating the alerts), but, in doing so, forgot to check app.js itself.