Skip to content

endidj/reduxtoolkit-nextjs-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Redux Toolkit + Next.js ( Typescript )

for example, study, boilerplate, whatever...



๐Ÿ“ Table of Contents

( Toolkit์„ ์“ฐ์ง€ ์•Š๋Š”, Redux์˜ ๊ธฐ๋ณธ์ ์ธ ์‚ฌ์šฉ๋ฒ•์€ endidj/redux-nextjs-typescript ์—์„œ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”. )

๐Ÿง About

Redux Toolkit ๋ฅผ Next.js( Typesciprt ) ํ”„๋กœ์ ํŠธ์— ,

  1. ์–ด๋–ป๊ฒŒ ์ ์šฉํ•˜๋Š”์ง€ ( How To Use ? )
  2. ์–ด๋–ค ํ˜„์ƒ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ( What Happen ? )

๐Ÿ‘พ Preview

  • ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ๋Š” ๋ Œ๋”๋ง์ด ๋  ๋–„๋งˆ๋‹ค ์ฝ˜์†”์— ์ฐํž™๋‹ˆ๋‹ค.
  • ( Redux์˜ ํšจ๊ณผ ) Left3์˜ + , - , Set 5 ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ
    Right3 ์ปดํฌ๋„ŒํŠธ๋งŒ์ด ์žฌ๋ Œ๋”๋ง ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋งŒ์•ฝ, props๋ฅผ ํ†ตํ•ด ์ƒํƒœ ๋ณ€๊ฒฝ์„ ํ–ˆ๋‹ค๋ฉด,
    ์ƒํƒœ๊ฐ€ ์ „๋‹ฌ๋˜๋Š” ๊ณผ์ •์—์„œ ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ๋“ค์ด ์žฌ๋ Œ๋”๋ง ๋์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

result

๐Ÿน Code Overview

๐Ÿ“ฆsrc
โ”ฃ ๐Ÿ“‚components
โ”ƒ โ”ฃ ๐Ÿ“œLeft.tsx          // Redux ์ „์—ญ์ƒํƒœ ๋ณ€๊ฒฝ
โ”ƒ โ”— ๐Ÿ“œRight.tsx         // Redux ์ „์—ญ์ƒํƒœ ๊ตฌ๋…
โ”ฃ ๐Ÿ“‚pages
โ”ƒ โ”ฃ ๐Ÿ“œindex.tsx         // ๋ฉ”์ธ ํŽ˜์ด์ง€
โ”ƒ โ”— ๐Ÿ“œ_app.tsx          // Redux Toolkit์„ ํ”„๋กœ์ ํŠธ์— ์ ์šฉ
โ”ฃ ๐Ÿ“‚store
โ”ƒ โ”ฃ ๐Ÿ“‚slices
โ”ƒ โ”ƒ โ”— ๐Ÿ“œcounterSlice.ts  // Counter Slice
โ”ƒ โ”— ๐Ÿ“œstore.ts          // ์ „์—ญ์ƒํƒœ ์ €์žฅ์†Œ
โ”— ๐Ÿ“‚styles
โ”ƒ โ”— ๐Ÿ“œglobals.css

๐Ÿš€ Run This Project

์˜์กด ๋ชจ๋“ˆ ์„ค์น˜ ,

yarn

๊ฐœ๋ฐœ ๋ชจ๋“œ ์‹คํ–‰ ,

yarn dev

์šด์˜ ๋ชจ๋“œ ์‹คํ–‰ ,

yarn build
yarn start

โ›๏ธ How To Init Redux Toolkit Project

ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ : Next.js ( typescript )

yarn create next-app project-name --typescript

Redux Toolkit ๋ชจ๋“ˆ : React, Next.js์™€ ํ˜ธํ™˜๋˜๋Š” ๋ชจ๋“ˆ

yarn add redux react-redux @reduxjs/toolkit

Redux ๋นŒ๋“œํƒ€์ž„ ๋ชจ๋“ˆ : ๋นŒ๋“œ์‹œ์—๋งŒ ์‚ฌ์šฉํ• , ๋ชจ๋“ˆ ๋ฐ @types

yarn add -D @types/react-redux

About

๐Ÿ“ Redux Toolkit+ Next.js ( Typescript )

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published