reselect
creating a memoized selector
createSelector
input-selectors의 배열을 받는다. 배열의 값은 함수로 변형시킨다.
만약 redux state tree가 input-selector의 값을 변경시키는 방식으로 변경되면, 셀렉터는 input-selector의 값을 인자로 사용하여 변형 함수를 호출하고 결과를 리턴할 것이다.
만약 input-selector의 값이 selector에게 이전에 호출했던 것과 똑같다면, 변경된 함수를 호출하는 대신 이전에 계산된 값을 리턴할 것이다.
input-selector
getVisibilityFilter
getTodos
getVisibleTodos만 memoized selector, input-selector는 non-memoized selector.
Composing Selectors
memoized selector가 input-selector가 될 수 있다. getVisibleTodos가 input-selector가 된 것을 볼 수 있다.
Last updated
Was this helpful?