You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine when the settings are loaded. But when a component uses this hook, there is an unpredictable time at the beginning when the settings are not loaded yet, and they get the fallback value.
I searched the docs and navigated the menu items. I could not find a page as a guide on how to remove that gap.
Please add a page for this purpose. Explain what is the react's official way to solve this problem. Explain how we can make sure that when we call a hook, we are guaranteed to get the data.
The text was updated successfully, but these errors were encountered:
Let's say I want to create a hook called
useSettings
. This hook will load settings once from an API and cache the data.This is a sample code:
This works fine when the settings are loaded. But when a component uses this hook, there is an unpredictable time at the beginning when the settings are not loaded yet, and they get the fallback value.
I searched the docs and navigated the menu items. I could not find a page as a guide on how to remove that gap.
Please add a page for this purpose. Explain what is the react's official way to solve this problem. Explain how we can make sure that when we call a hook, we are guaranteed to get the data.
The text was updated successfully, but these errors were encountered: