A modern development stack
Let's build a simple react form, then translate it into React Hook Form and finally learn how type it correctly :)
Together with react-hook-form, lets learn how to fetch data without explicitly writing any hooks :)
After running yarn build, the app will be built on .next folder, which CAN'T be served in a static provider like Hostinger (only on their VPS Linux)
In order for Next.js to run server side rendering and data fetching code, we need a server that supports Node.js
Just like Vercel headline: Develop, Preview, Ship. Vercel, Netlify, Heroku has support for PR deploys and SSR (with limited free usage, but reasonable)
Let's deploy on Netlify for now 🚀
Next.js is being constantly updated with new features, development server speed improvements, and bug fixes
(This slide was built in July 13th)
Bash commands |
---|
yarn dev # start development server |
yarn tsc # check for invalid typescript types |
yarn lint # check for ESLint/Prettier warning and Next.js best practices |
yarn build # check for errors before even deploying the app, and build the app on `.next` folder |
yarn storybook # test components in an isolated environment |
Bash commands |
---|
yarn generate component # will ask questions and create a component following boilerplate best practices |
yarn generate form # will ask questions and create a form with validation following boilerplate best practices |
yarn generate page # will ask questions and create a page with layout following boilerplate best practices |
Sometimes when commiting through VSCode UI you might receive this message for machines that setup Node.js with nvm.
Â
To fix that, just create a ~/.huskyrc with the following content:
# ~/.huskyrc
# This loads nvm.sh and sets the correct PATH before
# running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"