Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- import { connect } from 'react-redux'
- import {incrementAction, decrementAction} from './actions'
- const Counters = (props) => (
- <div>
- <h2>{props.counter}</h2>
- <button onClick={() => props.increment()}>+</button>
- <button onClick={() => props.decrement()}>-</button>
- </div>
- )
- const mapStateToProps = (state) => (/*...*/)
- const mapDispatchToProps = (dispatch) => ({
- increment: () => dispatch(incrementAction()),
- decrement: () => dispatch(decrementAction())
- })
- connect(mapStateToProps,mapDispatchToProps)(Counters)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement