Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A React component suspended while rendering, but no fallback UI was specified

Tags:

reactjs

I just started working on this new React app.

It was using <Suspense /> element in the component but I removed it. Then application is crashed with above error.

Is there any easy fix without know too much about <Suspense /> ?

enter image description here

like image 285
Ishan Patel Avatar asked Jan 30 '19 03:01

Ishan Patel


Video Answer


2 Answers

You have 2 options:

  1. 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     } }); 
  2. Using Suspense, for example:

    <Suspense fallback={<div>Loading... </div>}>        <App />  </Suspense>
like image 60
Guy Engel Avatar answered Sep 23 '22 14:09

Guy Engel


In order to fix this without putting Suspense back in, you would need to get rid of usages of React.lazy.

like image 22
Ryan Cogswell Avatar answered Sep 22 '22 14:09

Ryan Cogswell