Created
July 9, 2018 18:33
-
-
Save mcallegari10/407ca20c59f7b358a5af711df8cf5fc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
// We can use react-loadable to cover the most possibles outcomes of the code splitting | |
import Loadable from 'react-loadable'; | |
// My Loader component | |
import Loader from '@components/Loader'; | |
// Create the async route | |
const AsyncRoute = Loadable({ | |
loader: () => import('./index'), | |
loading() { | |
return <Loader />; | |
} | |
}); | |
// This is the component the React Router will use | |
const MyRoute = props => <AsyncRoute {...props} />; | |
export default MyRoute; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment