react-alert icon indicating copy to clipboard operation
react-alert copied to clipboard

Many contexts in one component

Open CodeWithMichal opened this issue 3 years ago • 1 comments

Hi, I am having difficulty using more than one context in component. Say I have two contexts: -InfoContext -ErrorContext

I know what to do if I want to use only one of them, since its simply: export default withAlert(InfoContext)(App) or export default withAlert(ErrorContext)(App)

But how can I use both of them in component? I tried to pass both contexts, like: export default withAlert(InfoContext, ErrorContext)(App) however I stucked at this point. Any sugestions?

Best regards, Michał

CodeWithMichal avatar May 26 '21 21:05 CodeWithMichal

Hi @LabuzzMichal. Is the question still relevant? Did you try to double-wrap the component with the HOC (I'm not sure that is the best way of doing this sort of stuff)? export default withAlert(InfoContext)(withAlert(ErrorContext)(App))

besLisbeth avatar Sep 21 '21 09:09 besLisbeth