- Minimal project using
Next.js
+Redux
+redux-thunk
+TypeScript
. - And finally, this project is deployed to
Now
.
- Next.js
v9.x
- Redux
v4.x
- redux-thunk
v2.x
- TypeScript
v3.5.x
- Now
v15.x
# setup
npm install
# local development
npm run dev:now
# browser ---> http://localhost:3000
# web api ---> GET http://localhost:3000/api/counter
# POST http://localhost:3000/api/counter/increment
# POST http://localhost:3000/api/counter/decrement
# POST http://localhost:3000/api/counter/reset
# deploy
npm run deploy:now
Note: You should update API_ENDPOINT of production config at next.config.js before your deploying.
Server
Get current count value in server.Server
Store the count instore
of redux in server.Server
Rendering in server.Browser
Request web api to server when buttons are clicked.Browser
The count value will be updated in browser.Browser
Re-Rendering in browser.
- Unexpected rebuild and restart entry points by
now dev
when I click buttons athttp://localhost:3000
. 🤔- So, the counter will not be working perfectly in local development.
- Because the local count value is reset. 😭