Learn how to implement adding a todo in a todo list application reducer. let todo = (state = [], action) => { switch(action.type){ case 'ADD_ITEM': return state = [ ...state, { text: action.text, id: action.id, completed: false } ]; default: return s…
Learn how to create a React todo list application using the reducers we wrote before. /** * A reducer for a single todo * @param state * @param action * @returns {*} */ const todo = ( state, action ) => { switch ( action.type ) { case 'ADD_TODO': ret…
/** * A reducer for a single todo * @param state * @param action * @returns {*} */ const todo = ( state, action ) => { switch ( action.type ) { case 'ADD_TODO': return { id: action.id, text: action.text, completed: false }; case 'TOGGLE_TODO': if ( s…
Learn how to implement toggling a todo in a todo list application reducer. let todo = (state = [], action) => { switch(action.type){ case 'ADD_ITEM': return state = [ ...state, { text: action.text, id: action.id, completed: false } ]; case 'TOGGLE_IT…
今天,我将Youtube上的<RxJS + Redux + React = Amazing!>翻译(+机译)了下来,以供国内的同学学习,英文听力好的同学可以直接看原版视频: https://www.youtube.com/watch?v=AslncyG8whg 开场白 管理状态很困难,对吧?如果你写过复杂应用,你一定对此深恶痛绝.React社区还有Angular2社区和Ember社区现在都开始使用一个库,叫Redux.为什么?因为它让管理状态变得简单多了.但Redux有个问题,就是它对你写异步…
今天,我将Youtube上的<RxJS + Redux + React = Amazing!>的后半部分翻译(+机译)了下来,以供国内的同学学习,英文听力好的同学可以直接看原版视频: https://www.youtube.com/watch?v=AslncyG8whg Observable 什么是Observable?让我们快速来了解一下它吧! Observable是一个由零个.一个或多个值组成的流.注意,是零个.一个或多个值.零个意味着可以没有值,这完全没问题.一个值的情况就像是Promi…
Redux Redux & React & react-redux https://redux.js.org/ https://redux.js.org/api https://redux.js.org/introduction/threeprinciples https://redux.js.org/introduction/learningresources https://github.com/markerikson/react-redux-links/blob/master/red…
Redux React & Online Video Tutorials https://scrimba.com/@xgqfrms https://scrimba.com/c/cEwvKNud publish playlist RRAIO Redux React All In One Redux & React https://redux.js.org/ https://github.com/reduxjs/redux React https://react-redux.js.org/ h…
/** * A reducer for a single todo * @param state * @param action * @returns {*} */ const todo = ( state, action ) => { switch ( action.type ) { case 'ADD_TODO': return { id: action.id, text: action.text, completed: false }; case 'TOGGLE_TODO': if ( s…
目录 概述 React基本概念 JSX是什么? 设置React APP 初始化APP 应用结构 探索第一个React组件 index.js 变量和props JSX中的变量 组件props props使用实例 小结(React基本概念) 常用特性(以Todo List App的开发为例) 迭代(遍历)渲染 唯一key 处理事件(handling events) 处理表单提交 回调(callback) props State和useState hook 文本替换(React 无关) 概述 起因是,…