본문 바로가기

State

(3)
상태 정규화하기[Redux][Normalizing State Shape][프론트엔드 상태관리] https://redux.js.org/usage/structuring-reducers/normalizing-state-shape Normalizing State Shape | Redux Structuring Reducers > Normalizing State Shape: Why and how to store data items for lookup based on ID redux.js.org 많은 애플리케이션은 중첩되거나 관계형인 데이터를 처리합니다. 블로그 편집자는 많은 게시물을 가질 수 있고, 각 게시물에는 많은 댓글이 있을 수 있으며, 게시물과 댓글은 모두 유저가 작성합니다. 애플리케이션 데이터는 다음과 같을 수 있습니다. const blogPosts = [ { id: 'post1', author: ..
XState : 상태 머신과 상태차트 소개 공식 문서를 번역한 내용입니다. Introduction to state machines and statecharts | XState Docs Introduction to state machines and statecharts Statecharts are a visual language used to describe the states in a process. You may have used similar diagrams in the past to design user flows, plan databases or map app architecture. Statecharts are another xstate.js.org 상태 차트는 프로세스의 상태를 설명하는 데 사용되는 시각적 언어입니다. 과거에 유사한 다..
[Epic React] async 훅 사용 시 하나의 state를 사용하는 이유 state / loading / error 각각 다른 상태로 만들 경우. 데이터를 세팅하고 상태를 업데이트 하는 순서를 지키지 않으면 오류가 발생한다. (상태는 바뀌었으나 데이터가 없으면 오류 발생) // useEffect hooks... React.useEffect(() => { if (!pokemonName) { return } setStatus('pending') fetchPokemon(pokemonName).then( pokemon => { setPokemon(pokemon) setStatus('resolved') }, error => { setError(error) setStatus('rejected') }, ) }, [pokemonName]) // ... jsx part if (status =..