My react app structures like this (simplified)
<App> -->
need UserId information to conditional render something
return (
<Header/>
<Contents/>
)
<Header> -->
const login = () => retrieves an UserId after user login
return (
<Navbar etc/>
)
<Content> --> requires UserId information to do something
After user login in <Header> component, I need to pass it back to <App> as well as share it with <Content> component and others.
As my react app has more than five sibling components which all need access to userId information, I think it might not be a wise choice pass the information one by one using props. Would it be better to use Redux here because as far as I read, Context is for passing from parent to child not vice versa?