8000 GitHub - tbnsok40/Redux-tutorial: Prototype for Description publishing in Medical Institute ๐Ÿฅ
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tbnsok40/Redux-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

43 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

  • ๋ฆฌ๋•์Šค ์„ค์น˜ npm i redux react-redux redux-thunk redux-devtools-extension

  • store.js ์ƒ์„ฑ

  • ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž‘์„ฑ

  • App.js ๋‚ด๋ถ€์— Provider, store import

  • Provider ๋กœ ์ „์ฒด ๊ฐ์‹ธ๊ธฐ

  • reducers ํŒŒ์ผ ์ƒ์„ฑ

  • ๋‚ด๋ถ€์— index.js ์ƒ์„ฑ

  • ํ™˜์ž ๊ฐ์ฒด post๋กœ ์ƒ์„ฑ --> db.json์— "patients":{} ๋งŒ๋“ค์ง€ ์•Š๊ณ , ๊ณง๋ฐ”๋กœ fetch ๊ฐ€๋Šฅํ• ๊นŒ?

(๋ณ‘์› ๊ฐœ์ธ์ •๋ณด๋™์˜์„œ ๋ฐœ๊ธ‰ ๊ธฐ๋Šฅ => ๋ฐœ๊ธ‰๋œ ์„œ๋ฅ˜๋Š” ์–ด๋–ป๊ฒŒ ์ €์žฅํ•  ๊ฒƒ์ธ)

  • push ๊ฐ€ ์™œ ์•ˆ๋ผ?

State is immutable, that's the rule of redux.

Mutaion in state is not recommended.

Instead mutating the state, just return another object. for example using filter method in array state is a. good method to delete some elements in array. Because filter() method just return a new state(array) instead mutate a state.

Redux is just a function.

Dispatching actions, and modifying the data(states) through the actions.

it is good to separate functions as its minimum responsiblity, dispatchors should only perform dispatching actions, and those actions will get an action type and data(payload).

So that the reducers will change the state(data) and we can use those updated data through the 'getState() method'.

In Redux Middleware, Reducer is the only place that states of data modified, so that it is easy to handle the data and states.

If we don't use Redux, all data and states are handled in the component level which will occur big difficulty in controlling data because the states will be separated in all of components.

About

Prototype for Description publishing in Medical Institute ๐Ÿฅ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0