muthu kumar
muthu kumar

Reputation: 66

React Suspense is not showing fallback second time component renders

I am doing some heavy operations inside field component and it is taking some time to render the component. So i am using react suspense to show loader. When i turn on editMode first time, able to see fallback. but after first time if i turn on edit mode again, fallback is not triggered and i am seeing delay in rendering field component. How to show fallback on subsequent render?

import React, { lazy, Suspense } from 'react'

const Field = React.lazy(() => import('Field.js'));


export default function HomePage() {
  return (
    filteredTableColumns.map((column, index) => {
        <div>
           {editMode ? (
                <Suspense fallback={<div>...</div>}>
                     <Field column={column}/>
                 </Suspense>
                 ) : ( renderText[column.render](d[column.key])
           )}
       </div>
  })
}

Upvotes: 1

Views: 441

Answers (0)

Related Questions