Estoy practicando el react-redux. Me pregunto cuál es la diferencia entre estos dos códigos. Creo que estos tienen el mismo significado, pero el primer código no funciona bien. El primero no puede entregar los puntales del Estado. Eliminé la parte "importar" en esta publicación.
const TodosContainer = ({ input, todos, changeInput, insert, toggle, remove }) => { return (<Todos input={input} todos={todos} onChangeInput={changeInput} onInsert={insert} onToggle={toggle} onRemove={remove} />); }; // from this point, I changed this code into below one const mapStateToProps = state => ({ // in this part, I think it cannot send props input: state.todos.input, todos: state.todos.todos }); const mapDispatchToProps = dispatch => ({ changeInput: () => { dispatch(changeInput()); }, insert: () => { dispatch(insert()); }, toggle: () => { dispatch(toggle()); }, remove: () => { dispatch(remove()); } }); export default connect( mapStateToProps, mapDispatchToProps)(TodosContainer); export default connect( ({ todos }) => ({ input: todos.input, todos: todos.todos, }), { changeInput, insert, toggle, remove, } )(TodosContainer);