The trend right now with frameworks like Next.js is to move data fetching back to the server side. This means things will be fast and you often wont need the fancy client side caching that you traditionally spent all kinds of energy setting up on the client side. So you might be interested in using the standard javascript fetch api to query graphql and use it in a functional react component.

CSRF Security

If you are using rails you'll need a csrf token to make any requests at all. also use the useContext hook to pass your csrf token into your component.