Open vnglst opened 6 years ago
I've got a question about the following example code in the Readme:
// src/containers/Hello.tsx import Hello from '../components/Hello'; import * as actions from '../actions/'; import { StoreState } from '../types/index'; import { connect, Dispatch } from 'react-redux'; export function mapStateToProps({ enthusiasmLevel, languageName }: StoreState) { return { enthusiasmLevel, name: languageName, } } export function mapDispatchToProps(dispatch: Dispatch<actions.EnthusiasmAction>) { return { onIncrement: () => dispatch(actions.incrementEnthusiasm()), onDecrement: () => dispatch(actions.decrementEnthusiasm()), } } export default connect(mapStateToProps, mapDispatchToProps)(Hello);
I don't think mapStateToProps and mapDispatchToProps should be exported in this case (see for instance the official redux docs: https://github.com/reduxjs/react-redux/blob/master/docs/api.md)
mapStateToProps
mapDispatchToProps
Or is there a particular reason the export these functions in this case?
If not, I'll be glad to create a PR for this!
Great tutorials btw, it really helped me to get started quickly with the TypeScript & Redux combo. 🎊
I've got a question about the following example code in the Readme:
I don't think
mapStateToProps
andmapDispatchToProps
should be exported in this case (see for instance the official redux docs: https://github.com/reduxjs/react-redux/blob/master/docs/api.md)Or is there a particular reason the export these functions in this case?
If not, I'll be glad to create a PR for this!
Great tutorials btw, it really helped me to get started quickly with the TypeScript & Redux combo. 🎊