- Deployment Steps & Pitfalls
- Test Code: Manually & with automated tests
- Optimize Code: Optimize user experience & performance
- Lazy Loading: Load code only when it's needed
- Having to load all the code initially will slow down that initial page load
- Build App: Run build process to parse, transform & optimize code
- Upload App: Upload production code to hosting server
- Configure Server: Ensure app is served securely & as intended
- Server-side Routing vs Client-side Routing
- run
npm install
- run
npm start
- create a
README.md
file - create a
.gitignore
file
- in
App.js
, in order to load theBlogPage
lazily, remove theimport
of theBlogPage
& thePostPage
- load the
loader
lazily by using theimport()
function - load the
BlogPage
&PostPage
components lazily - use the
lazy()
fonction imported fromreact
- wrap the
<BlogPage>
&<PostPage>
components with the<Suspense>
component imported fromreact
- in the terminal, execute
npm run build
- a
build
folder is created & ready to be rendered
- in Firebase Hosting, create a new project named
react-deployment-demo
for example - in your terminal, run
npm install -g firebase-tools
firebase login
firebase init
firebase deploy