react-lazy-load-with-retries
v0.0.2
Published
If the file cannot be downloaded during navigation due to an error or network issue, the app may crash as React.lazy fails to import the component. To handle this situation gracefully, it's important to implement proper error handling and retry mechanisms
Downloads
2
Maintainers
Readme
lazyLoadWithRetry
If the file cannot be downloaded during navigation due to an error or network issue, the app may crash as React.lazy fails to import the component. To handle this situation gracefully, it's important to implement proper error handling and retry mechanisms to ensure smooth performance of the application. react-lazy-load-with-retries will help you fix this issue.
Usage
npm i react-lazy-load-with-retries
import { Suspense } from 'react';
import { lazyLoadWithRetries } from 'react-lazy-load-with-retries';
function App() {
const MyButton = lazyLoadWithRetries(()=> import('./lib/MyButton'))
return (
<>
<Suspense fallback="<div>Loading</div>">
<MyButton/>
</Suspense>
</>
);
}
export default App;