5

I'm working with Relay Modern on Project. But I'm not sure how to send data from a place when I put fragment to place where Is component placed.

for example:

this is components composition

-Page (QueryRenderer)
---Header
---body
  ---List
     --UserAutocomplete

List is Fragment, something like fragment PaymentsList on Payment UserAutocomplete is also fragment but on RootQuery fragment UserAutocomplete_users on RootQuery

Actually, I put bout this fragment in query for QueryRenderer graphql` query PaymentQuery { ...PaymentsList ...UserAutocompleteFragment_users }

But then I got data for UserAutocomplete here and I must send this data for UserAtocomplete component down through props. Is there some better way something like got this data from a store instead of sending them through props?

Grund
  • 269
  • 1
  • 2
  • 11
  • I have the same problem! I really want to be able to easily pass data through a component that is grouping a bunch of other components. The data isn't nested, it's flat. Not sure the best way to pass data through a parent component – jordancooperman Nov 17 '17 at 02:40
  • I wonder why they didn't took Redux's connect example. The container should be something similar so instead of passing data down through props you get them directly from containers – hisa_py Jan 30 '18 at 19:50
  • First thing you get taught when learning Relay its that you should be able to work inside a component without need to know whats going on other containers, isn't Relay clever enough to pass you the properties from the top container to the bottom one directly? – Kiko Seijo Jan 30 '18 at 22:48
  • Maybe there is an undocumented mechanism. Anyway, I wrote a proposal in https://github.com/facebook/relay/issues/2305, which at the end addresses this question – hisa_py Jan 31 '18 at 12:52

0 Answers0