apollo-graphql-mongodb-react-native | Apollo Server Example using MongoDB + Mongoose + Express | GraphQL library
kandi X-RAY | apollo-graphql-mongodb-react-native Summary
kandi X-RAY | apollo-graphql-mongodb-react-native Summary
This repo goes along with the Medium post React Native with Apollo Server and Client. There are two parts to this application: the client (React Native Application) and the server (GraphQL server).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of apollo-graphql-mongodb-react-native
apollo-graphql-mongodb-react-native Key Features
apollo-graphql-mongodb-react-native Examples and Code Snippets
Community Discussions
Trending Discussions on apollo-graphql-mongodb-react-native
QUESTION
I've been researching this for the past couple hours, and I am now extremely close to solving this. Everything seems to be working now, but I do not have this.props.mutate
in my component that has the Apollo HOC wrapping it.
I wired Apollo up as a reducer, so in my component, I would expect to see this.props.apollo.mutate
available, but it's not there.
This is all that seems to be provided currently:
...console.log(this.props.apollo)
ANSWER
Answered 2017-Oct-22 at 04:28When you use compose
, the order of your HOCs matters. In your code, the props added by your first HOC (connect
) are available to all the HOCs after it (withFormik
and graphql
). The props added by withFormik
are only available to graphql
. The props added by graphql
are available to neither of the other two HOCs (just the component itself).
If you rearrange the order to be compose
-> graphql
-> withFormik
then you should have access to props.mutate
inside withFormik
.
Additionally, while you can integrate Redux and Apollo, all this does is prevent you from having two separate stores. Passing an existing store to Apollo is not going to change the API for the graphql
HOC. That means, regardless of what store you're using, when you correctly use the HOC, you will still get a data
prop (or a mutate
prop for mutations).
While integrating Apollo with Redux does expose Apollo's store to your application, you should still use Apollo like normal. In most cases, that means using the graphql
HOC and utilizing data.props
and data.mutate
(or whatever you call those props if you pass in a name through options).
If you need to call the Apollo client directly, then use withApollo instead -- this exposes a client
prop that you can then use. The apollo
prop that connect
exposes in your code is just the store used by Apollo -- it's not the actual client, so it will not have methods like mutate
available to it. In most cases, though, there's no reason to go with withApollo
over graphql
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install apollo-graphql-mongodb-react-native
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page