Skip to content

[#2] Redux 상태변화에 따른 Page rerender을 하지 않는 reSelect #2

@wnsdudSoftkim

Description

@wnsdudSoftkim

프로그램 구조

image

배경

Footer에 있는 Video,Audio on/off 기능 및 Section (영상처리) 부담을 최대한 최소화 하기 위해
Component를 나누며 각 상태관리를 Redux의 store로 통합 관리한다.
왜 사용할까?
selector는 Redux가 적은 양의 필요한 데이터만을 갖고 있게 data들의 연산을 도우며, state를 가져오는 컴포넌트들과 state의 구조 사이에 1개의 층(selector)를 두어 구조가 바뀌어도 연관된 모든 컴포넌트를 바꿀 필요 없이 selector 만 바꿔주면 성능이 향상되기 때문에 사용합니다.

문제점

상태관리가 변경됬는데 Select는 초기값 이후 한번 밖에 변경되지 않는 이유는???

  //video audio 상태관리
const myvideoaudio = useSelector(state=>state.toggleVideoAudio)
 useEffect(()=> {
        gotmedia()
        console.log(":useEffect 불림")
    },[myvideoaudio])

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions