useSuspense false and use of loaders when not ready do not seem to work well
See original GitHub issueHello all,
I am using react-i18next with useSuspense set to false. Then I grab the translations like this:
const {t, ready} = useTranslation("header-footer");
const translationsAvailable = ready;
Then in my render I have this:
if (translationsAvailable === false){
return (
<div className="text-center">
<Loader height={30} weight={30} />
</div>
);
}
However, when I enter the website or refresh, etc. For a fraction of a second I can see the translation keys(e.g. “header-home”, “header-about”, etc.) rather than my loader.
Based on the documentation I think I am doing everything needed. Is this a bug or is this expected?
Thank you in advance and kind regards.
- Device: 15" Laptop
- Browser: Firefox 69.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
React-i18next suspense - Stack Overflow
Just be aware that choosing not to use Suspense has its implications. ... is not ready and your component render when the state...
Read more >Suspense for Data Fetching (Experimental) - React
It's a mechanism for data fetching libraries to communicate to React that the data a component is reading is not ready yet. React...
Read more >Using React 18's Suspense to Improve Code Quality of Web ...
Take a look at the example below, which uses the Suspense wrapper to display a typical loader until the <LazyLoadComponent> is ready.
Read more >All You Need To Know About React Suspense - CopyCat Blog
What does React Suspense lets you do and what does it not? React Suspense Frequently Asked Questions. Why Do We Use Suspense in...
Read more >React Suspense: Lessons Learned While Loading Data
Fortunately, the React team was smart enough to not limit these efforts ... work I've done on my side project (again, don't use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I didn’t even know it is possible, even looking at the source I still don’t understand how that is. Anyways, discard my comment in this case! 😄
Edit: now I see it, really clever trick
closing this for now…feel free to reopen with more insights