Why fetch data by id on the destination screen?
Because it avoids passing large data through navigation. Pass an id in the URL, and the destination screen fetches the full data. This keeps navigations light and the destination screen resilient to reloads.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How to Pass Data Between Screens in a React App
Use URL parameters for identity, query parameters for filters, Link state for one-time transitions, Context or a store for widely-shared data, and a server fetch by id for large data. The question of whether data should survive a reload dictates the pattern.
For data that identifies a screen, like /user/:id. URL parameters make the screen shareable and bookmarkable, and they survive reloads, which is the right behavior for identity.
For small, one-time data between navigations, like a success message after a redirect. It does not survive a reload, so only use it for non-essential transitions, not for data the destination screen depends on.
Still have questions?
Browse all our FAQs or reach out to our support team
