Meaning of state in Reducer - seowonintech/react-native-todo-list GitHub Wiki
- TodoList.js의 mapStateToProps에서 state로 넘어오는 것은 combineReducers에서 Param으로 넘긴 값이다.
// reducer/index.js
const reducer = combineReducers({
manipulateTodos
});
// container/TodoList.js
const mapStateToProps = (state) => ({
todos: state.manipulateTodos
});- reducer에서 Action parameter는 항상 action function에서 return하는 값과 일치해야 한다.
- 매우 간단한 사실이지만 자주 까먹는다.
- component/AddTodo.js에서 onChangeText 이벤트가 발생하는 경우 그 text를 redux store에 저장시킨다.
- Stateless controller (ex: TextInput)에서는 ref를 못쓴다.
console.warn() 을 쓰면 화면과 동시에 콘솔에서도 로그를 볼 수 있다.