Introduction

<script src="https://unpkg.com/react@18.2.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js"></script>
npm init -y

Install Prettier

For all project on VSCode

npm i --global prettier

Optional steps: open settings, then set prettier.requireConfig = true and editor.formatOnSave = true

or

For locally in the project folder

npm i -D prettier@2.7.1
npm install --save-dev --save-exact prettier
// package.json
"scripts": {
    "format": "prettier --write \"src/**/*.{js,jsx}\""
  },

Install eslint (handle aturan dalam penulisan code React)

npm install -D eslint@8.24.0 eslint-config-prettier@8.5.0

Create an .eslintrc.json

Add this script to package.json:

Git is important in project management and version control

  • Initialize project as a Git repo using git init

  • Ignore items to be pushed by creating a .gitignore file

Server untuk menjalankan project React Vite

What are the benefits of using build tools?

  1. File separation

  2. Third-party libraries

  3. Minifying and optimize code

Install ESLint for React JSX

Update .eslintrc.json

Create config .env

Hooks

Applying useState!

Add ESLint rule for hooks.

Add it into .eslintrc.json file

React Router

Last updated