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를 못쓴다.

Debugging

console.warn() 을 쓰면 화면과 동시에 콘솔에서도 로그를 볼 수 있다.

⚠️ **GitHub.com Fallback** ⚠️