3

This seems like a basic idea but I can't seem to wrap my head around it.

In Redux, defining what happens to the store and which props I pass to components is entirely up to me. In Relay, I can define a render function in my container where I return a component based on the ready state. What I really want would look something more like:

render({ props }) {
  if (!props) store.dispatch(toggleSpinner(true))
  else {
    store.dispatch(toggleSpinner(false))
    return <Container {...props} />
  }
}

Then in whatever component:

<Spinner show={props.spinnerIsShowing) />

..but of course I'm not mixing redux and relay, and I imagine there's a 'relay way' of doing exactly this.

azium
  • 17,620
  • 5
  • 44
  • 73
  • Are you trying to make the spinner show up while relay is fetching data? – Narongdej Sarnsuwan Aug 03 '16 at 17:13
  • for instance, but it really could be anything.. basically send some prop while relay is loading. I got it working by doing exactly what I proposed in my question basically.. dispatch my redux store `onReadyStateChange` – azium Aug 03 '16 at 17:36

0 Answers0