This is really a time-saver!
Especially if you import the decrement() and increment() action creator functions from the actions file. Then your example becomes even shorter:
decrement()
increment()
import { decrement, increment } from '../redux/actions'; const mapDispatchToProps = { decrement, increment, };
And if you use TypeScript, it is now trivial to define the types:
interface DispatchProps { decrement: typeof decrement; increment: typeof increment; }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is really a time-saver!
Especially if you import the
decrement()
andincrement()
action creator functions from the actions file. Then your example becomes even shorter:And if you use TypeScript, it is now trivial to define the types: