05 Query ( config )
- Details
• Stale time ( default: 0)
Length of time before your data gets stale.
If the data is fresh then React Query pulls the data from the cache repeatedly, without calls to the server.
• refetchOnMount ( default : true )
Reload data if it is stale.
The component is mounted.
• refetchOnFocus( default: true ) / false / always
When the user clicks on the screen it refreshes the data.
• poll data
• refetchInterval: (default) 2000
refreshes every two seconds
• refetchIntervalInBackground <- even if browser is not in focus
• Can just fetch when a button is pressed / method called.
- config - to turn off the automatic behaviour.
Use refetch hook to pull back the data.