schiehll / react-alert

alerts for React
MIT License
608 stars 98 forks source link

Functions are not valid as a React child #100

Closed saiemsaeed closed 5 years ago

saiemsaeed commented 5 years ago

I installed lastest version 5.0.0 and implemented same as instructed in documentation, but when i attach withRouter HOC in my app. It gives me error in console that Functions are not valid as a React child.

screenshot 2019-02-12 at 2 57 21 pm screenshot 2019-02-12 at 2 57 05 pm
schiehll commented 5 years ago

Hey @saiemsaeed can you try like this: export default withRouter(withAlert()(Login))?

See the extra () between withAlert and (Login).

saiemsaeed commented 5 years ago

Ah Suck, not putting () wasted my couple of hours. Thanks @schiehll for the help. You should update documentation.

schiehll commented 5 years ago

The example in the docs have the extra (), I just double checked. I'm glad it solved!

saiemsaeed commented 5 years ago

@schiehll i was following docs on npm package page. Please check, its wrong there!

schiehll commented 5 years ago

Oh yeah, didn't noticed, thank you for pointing it out! I will update it.