//container
import { connect } from 'react-redux'
import FollowerGroupNewForm from '../../components/_forms/FollowerGroupNewForm'
import { getTags } from '../../actions/tags'
const mapDispatchToProps = dispatch => {
return ({
getTags: () => dispatch(getTags())
})
}
const mapStateToProps = state => {
return ({
authInfo: state.authInfo,
hi: 'hi'
})
}
export default connect(mapStateToProps, mapDispatchToProps)(FollowerGroupNewForm)
//component
componentDidMount () {
const { props: { getTags } } = this
console.log(this.props)
getTags().then(data => {
const tags = data.map(tag => ({
value: tag.name,
label: tag.name
}))
this.setState({ tags: tags })
})
}
getTags 为 undefined, 没找到原因,求助!
试试看这样: