Routing

Routing

How Routing can work with the updated APIs.

The classic Relay API had routing deeply built in with Relay.Route, which tied navigation and data fetching together. With the modern API, routing is no longer part of Relay. So what should you do for routing in your use case? There's no one-size-fits all answer so it depends on your use case and evaluation of the options.

No Routing

If the Relay part of an application is some widget or single view as part of a larger application, you don't need any new routing. You can just render a Relay.QueryRenderer somewhere on the page to fetch and render the data you need there.

  • Pro: Easy to understand.

This option is simple and should be used when sufficient.

Relay.Route

The legacy Relay.Route mechanism can still be used by just leaving