'A React component suspended while rendering, but no fallback UI was specified
Solution 1:[1]
You have 2 options:
Without Using suspense, you can configure that i18n.js like this:
i18n .use(XHR) .use(LanguageDetector) .init({ react: { useSuspense: false // <---- this will do the magic } });Using Suspense, for example:
<Suspense fallback={<div>Loading... </div>}> <App /> </Suspense>
Solution 2:[2]
I know it's not exactly @IshanPatel's problem but what can cause this error message is if you use a hook like useTranslation() directly inside of the function holding <Suspense />. The solution is to move that code simply into a separate function and have the hook there (see screenshot).
This came up first on Google and I guess someone could waste a long time on finding a fix so I wanted to share it as comment.
Solution 3:[3]
Removing React.lazy is not a good idea. Since if your application grows it will take too much time to load the home page.
For react-router v6+ we have the following:
<Route path="about" element={
<React.Suspense fallback={<>...</>}>
<About />
</React.Suspense>
} />
Solution 4:[4]
One error we are easy to make:
// Error: In the fallback component, don't use i18n!
// <Suspense fallback={<div>{t('loading')}... </div>}>
// This is correct
<Suspense fallback={<div>Loading... </div>}>
<App />
</Suspense>
Solution 5:[5]
Also, dont forget about fallback prop in Suspense component - it wont work without it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jose A |
| Solution 2 | slackwing |
| Solution 3 | Vahid Najafi |
| Solution 4 | silencej |
| Solution 5 | user3765649 |


