Skip to content

Instantly share code, notes, and snippets.

@efernandesng
Created March 9, 2016 14:41
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save efernandesng/775a16b8cc3433fd4033 to your computer and use it in GitHub Desktop.
Save efernandesng/775a16b8cc3433fd4033 to your computer and use it in GitHub Desktop.
react-intl injectIntl decorator
import React, {Component, PropTypes} from 'react';
import {intlShape} from 'react-intl';
import {injectIntl} from './decorator';
@injectIntl()
class Xpto extends Component {
static propTypes = {
intl: intlShape.isRequired
};
render() {
const {intl} = this.props;
return <div>Locale:{intl.locale}</div>;
}
}
import {injectIntl as inject} from 'react-intl';
export const injectIntl = options => target=> {
return inject(target, options);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment