-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing properties through a <Page ...> element. #98
Comments
That's fine to keep those things in the top-level element's state; something similar to that is generally done with Fluxxor. There are a few options for passing that down through every element.
My top-level component uses the 'lots-of-wires' method. I mitigate it in some cases by using a Fluxxor plugin I wrote, but it's not a total cure. Lots of other users have come across this, though - here's some good thoughts on it. |
Thanks for your help. I hadn't realised that adding a property to a Does this property-cascading behaviour hold throughout ReactJS, or is it a react-router-component special for |
That's just for RRC - |
Thanks, that explains it. I've chosen to pass the properties through the pages, and it works nicely.
The last remaining issue is when a login-protected page (such as I think this issue is more of a react-async thing, but if you have any insight here, it would be very welcome. |
Solution found: andreypopp/react-async#37 |
I have some state in the top level "App" element (the one which renders
<Pages ...>
.At the moment, the only top-level state is "logged_in", which is either null or contains the logged-in user's name. (The server also checks whether a user is logged in for sever-side page renders and REST API calls.)
I'm thinking of the top-level element's state as a client-side "session" - is this a problem?
I'd like to pass the "logged_in" state down into each page as a property, but to do that I think I'd somehow need to pass it through the
<Page ...>
elements.Is there a method to do this, or is there a better approach to maintaining client-side "session" scope?
P.S. Another thing I'd like to pass to the pages (or rather just the Log In page) is a call-back to change the App logged_in state.
The text was updated successfully, but these errors were encountered: