How to use injectintl along with connect in the application using react-intl 2.0 and redux. See the last two lines of my code and tell me what is the proper way of doing that.
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);
You can wrap as follows:
export default injectIntl(
connect(mapStateToProps, null, null, { withRef: true }
)(TodoItem))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With