Add simple route-based code splitting

This commit is contained in:
Melvin Valster
2019-07-26 23:45:47 +02:00
parent f80774c18f
commit 12702d7592
9 changed files with 98 additions and 22 deletions
+16
View File
@@ -0,0 +1,16 @@
import React, { FC } from 'react'
import { LoadingComponentProps as Props } from 'react-loadable'
export const PageLoader: FC<Props> = ({ isLoading, pastDelay, error, retry, timedOut }) => {
const retryButton = <button onClick={retry}>retry</button>
if (error) {
return <div>Something went awry... do you wish to {retryButton}?</div>
} else if (timedOut) {
return <div>Taking some time... {retryButton}?</div>
} else if (pastDelay) {
return <div>Loading...</div>
} else {
return null
}
}