Passing query result from one component/view to another

Shopify Partner
9 0 1

Hey everyone, 

 

My question seems like one that would have been asked/answered before yet, after a couple days of searching, I cannot find a good answer. I am working off of this tutorial ( here's the git repo) but have made some small customizations, like manipulating customer metafields instead of products.

 

I make a query in one component (for a list of customers), but cannot figure out how to then pass a value from that query into a new component/view to be used in a new query (like passing the ID of the customer in the list that was clicked on so I can query for all of the info related to that specific customer). 

 

This seems like a fundamental problem and I just cant find any good direction on it.  I've tried using Apollo to manage local state but haven't had any success.  I'm new to React so perhaps there is some easy way to handle this with states/props. Any help would be tremendous. Thanks in advance. 

 

-J 

 

 

 

 

0 Likes
Community Manager
Community Manager
618 45 77

Hi @JacksonHowell,

 

I, like you, am new to React. I've found this Medium article on the subject of passing data between components super helpful in the past, so I'll share it with you.

 

https://medium.com/@ruthmpardee/passing-data-between-react-components-103ad82ebd17

 

Hopefully it can help you too!

 

Cheers,

0 Likes
Highlighted
Shopify Partner
9 0 1

Saw this article but couldn't get it to work

 

I've been to do it with apollo state management or NextJS and useContext hooks, still no luck

0 Likes