lugondev / tma-fe-next

Home Page:https://tma-fe-next.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This file is written with the help Markdown Cheat Sheet

Pre-requisites

  1. Json Server

// Installation
npm install -g json-server

// Create Data File
// Create db.json file under json-server folder

// Run Server
json-server --watch db.json --port 3004

Project Setup

This is a Next.js TypeScript project bootstrapped with npx create-next-app --typescript.

Configuring Redux using Redux Toolkit

  1. Installation of Redux Toolkit (Reference#1, Reference#2)

    npm install --save react-redux @reduxjs/toolkit @types/react-redux

  2. Configure Store (Reference#1, )

  3. Provide the Redux Store to React (Reference#1)

  4. Define Typed Hooks (Reference#1)

  5. Creating Slices

    Slices create Action Creators and Reducers from same file. Learn about Slices from here

  6. Use Typed Hooks in Components (Reference)

Using RTK Query (instead Creating Slices)

Note

  • Use queries for requests that retrieve data.
  • For anything that alters data on the server or will possibly invalidate the cache, you should use a Mutation

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.tsx.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

https://tma-fe-next.vercel.app


Languages

Language:TypeScript 83.4%Language:CSS 16.2%Language:JavaScript 0.4%