Answers for "suspense react"

9

suspense react

import React, {Suspense} from 'react;
const ProfilePage = React.lazy(() => import('./ProfilePage')); // Lazy-loaded

// Show a spinner while the profile [data fetching] is loading
<Suspense fallback={<Spinner />}>
  <ProfilePage />
</Suspense>
Posted by: Guest on August-13-2020
0

react suspense chunck

import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import React, { Suspense, lazy } from 'react';

const Home = lazy(() => import('./routes/Home'));
const About = lazy(() => import('./routes/About'));

const App = () => (
  <Router>
    <Suspense fallback={<div>Chargement...</div>}>
      <Switch>
        <Route exact path="/" component={Home}/>
        <Route path="/about" component={About}/>
      </Switch>
    </Suspense>
  </Router>
);
Posted by: Guest on February-12-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language