4

I have specific requirement in Relay-Modern to pass current date as arguments. From which i understand it's not possible in Relay-Modern as we can not write any code in initialVariables(was part of Relay Classic Api) as this step is now shifted to build Time. So i am using QueryRenderer at parent level to pass variables down to component at the time of mount.It worked well when i used this approach for 1 component. But now i got into another issue in which i have two component which shows same data but using different variables.

Current Widget

Shows 10 Records based on current time

Delayed Widget

Shows 20 records starting currentTime - 30 mins

Both components can have common data.

When i am declaring their own variables at parent level it is failing at compile time :

Expected all fields on the same parent with the name or alias events to have the same name and arguments

What would be correct approach to resolve these issues in Relay-Modern?

P.S.: I know hackyway of doing it to get big data set in both components or parent level then have logic in JS to filter and show on UI.

Anil Sharma
  • 275
  • 1
  • 6
  • 16

0 Answers0