hey guys, can I ask you something? I think I'm mis...
# prisma-whats-new
r
hey guys, can I ask you something? I think I'm missing part of the bigger picture of graphql/graphqool. Does Apollo keep its own store that I can query? For instance, I have a profile component that I pass an id, what is the simplest way to check if that id is the current user? When using redux I would just make a selector that returns a boolean, but here Im not sure.
a
You can easily connect Apollo to your own redux store, instead of its internal store: http://dev.apollodata.com/react/redux.html
r
so thats what I would need to do in this case?
save the currentUserId in my own store?
a
Yes, you don't even have to connect Apollo to your own store for that actually, the Apollo store would just hold the nodes, your own store keeps track of 'application state', like the current user id.
r
so than its a matter of checking the provided id to the profile for example and compare
a
Yes
r
that sounds good, thanks a lot 🙂
😎 1
are there any other cases that youd normally use your own redux store?
a
Yes, in all cases 🙂 For example, I have a parent-child relation. User selects an item from the list, I store the selected parent in my redux state, then on the details screen, I filter the children by selected parent.
The last line on the page I linked says it:
This means you can easily pass variables into your queries that come from Redux state
r
got it, I come from a pure redux app so its kinda getting use to the fact that apollo takes over some of it, not sure yet where exactly I have to take over again
yup
thanks a lot 🙂
😎 1
a
The page contains a few clear examples of using the apollo store and your own store together here: http://dev.apollodata.com/react/redux.html#using-connect
r
gonna read up!
👍🏻 1
@agartha Can I also just use the apollo reducer in a selector?
a
which one?
r
the one under the key apollo and then ROOT_QUERY for example, because that also has the current user id
someone on reactiflux suggested to just add currentUserQuery again around the profile but I already use it in 2 other places. It would make for a lot of repetition
a
I think plugging into that is a bad idea. You have to make a clear seperation between application data, and application state. With reducer composition, your application state reducer should not access data in the apollo tree directly.
r
got it
so what would you do? Use my own redux reducer or use graphql(currentUserQuery) ...
a
Pass the currentUserId from my application state to the profile query
r
right, could you elaborate a little bit on why thats a better approach?
a
Sorry, not at this moment, I need to go. Maybe you can move this question over to https://graph.cool/forum so other users can chime in as well?