Tag: redux saga

使用ES6发电机的Reduce-saga与使用ES2017asynchronous/等待的redux-thunk的优点/缺点

现在有很多人谈论最新的孩子, yelouafi / redux-saga 。 它使用生成器函数来监听/分派操作。 在我把头围绕之前,我想知道使用redux-saga的优点/缺点,而不是下面的方法,我使用asynchronous/ await使用redux-thunk 。 一个组件可能看起来像这样,像平常一样调度操作。 import { login } from 'redux/auth'; class LoginForm extends Component { onClick(e) { e.preventDefault(); const { user, pass } = this.refs; this.props.dispatch(login(user.value, pass.value)); } render() { return (<div> <input type="text" ref="user" /> <input type="password" ref="pass" /> <button onClick={::this.onClick}>Sign In</button> </div>); } } export default connect((state) […]