Thanks for the response :) I enjoyed that article too. My question was if you would merge the two approaches here if you were using both Apollo and some sort of state management. In this article the data fetching was abstracted into a separate service. What's your thought process on deciding if the data fetching should be within the component or within a separate service?
I'm a software engineer with a lot of React and startup experience. I write about my opinions on React, using Firebase with React, and lessons from building my 1st startup, Retro.
Personally, I like to keep non-graphql data fetching in a separate file. This keeps my view logic & data logic isolated.
However, for graphql, the way I use it at least, the shape of the graphql query is tied to the component that is using it. so that is why I keep my graphql queries co-located in my react component.
hopefully that makes sense lol.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the response :) I enjoyed that article too. My question was if you would merge the two approaches here if you were using both Apollo and some sort of state management. In this article the data fetching was abstracted into a separate service. What's your thought process on deciding if the data fetching should be within the component or within a separate service?
Personally, I like to keep non-graphql data fetching in a separate file. This keeps my view logic & data logic isolated.
However, for graphql, the way I use it at least, the shape of the graphql query is tied to the component that is using it. so that is why I keep my graphql queries co-located in my react component.
hopefully that makes sense lol.