import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import testAction from '../actions/test'; class Home extends React.Component { clickBtn() { this.props.testAction('some new value'); } render() { return (
This is home. { this.props.test }
Go to topics
); } } const mapStateToProps = state => ({ test: state.home.test }); const mapDispatchToProps = dispatch => ({ testAction: value => dispatch(testAction(value)) }); export default connect(mapStateToProps, mapDispatchToProps)(Home);