如何使用react-intl 2.0和redux在应用程序中使用injectintl和connect.查看我的代码的最后两行,并告诉我这样做的正确方法是什么. import React from 'react';import { deleteTodo } from '../actions/todoActions';im
import React from 'react'; import { deleteTodo } from '../actions/todoActions'; import { connect } from 'react-redux'; import { injectIntl, FormattedRelative, FormattedNumber } from 'react-intl'; class TodoItem extends React.Component { working() { console.log('well it\'s working'); } render() { return (<p className="light" key={this.props.index}> {this.props.todo} <a className="red-text text-accent-3" href="#" onClick={e => { this.props.dispatch(deleteTodo(this.props.index)) }}>x</a> </p>); } } function mapStateToProps() { return { } } let injectedIntl = injectIntl(TodoItem); export default connect(mapStateToProps, null, null, {withRef: true})(injectedIntl);你可以包装如下:
export default injectIntl( connect(mapStateToProps, null, null, { withRef: true } )(TodoItem))