Skip to content

Instantly share code, notes, and snippets.

@qstrahl
Created September 22, 2016 16:00
Show Gist options
  • Save qstrahl/8e1c0018fb363f28533a33f4224dacb0 to your computer and use it in GitHub Desktop.
Save qstrahl/8e1c0018fb363f28533a33f4224dacb0 to your computer and use it in GitHub Desktop.
static childContextTypes = {
formatCurrency: React.PropTypes.func,
};
getChildContext() {
const { context } = this;
const { intl } = context;
return !intl ? context : { ...context,
formatCurrency: (n) => intl.formatNumber(n, {
style: 'currency',
currency: 'CAD',
currencyDisplay: 'symbol',
}),
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment