Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
There's no place like 127.0.0.1

Yüg eugeniosegala

:shipit:
There's no place like 127.0.0.1
View GitHub Profile
View lazy.js
import React, { Component, Suspense } from 'react';
const Prodotti = React.lazy(() => import('./containers/Prodotti'));
View suspense-inline.js
{this.state.prodotti &&
<Suspense fallback={<div>Caricamento...</div>}>
<Prodotti/>
</Suspense>
}
View suspense.js
<Route
path="/prodotti"
render={() => (
<Suspense fallback={<div>Caricamento...</div>}>
<Prodotti />
</Suspense>
)}
/>
View async-component.js
// Async Component from Maximilian Schwarzmüller
import React, { Component } from 'react';
const asyncComponent = (importComponent) => {
return class extends Component {
state = {
component: null,
};