It may be worth investigating if it would be possible to pass intl prop without having to wrap every component with injectIntl(Component). IIUC this is used to make intl prop available for the component.
Maybe we could wrap just injectIntl(App) and make App provide intl in context:
class App extends React.Component {
getChildContext() {
return {intl: this.props.intl};
}
...
}
App.childContextTypes = {
intl: React.PropTypes.object
};
Any component would then grab intl from context as 'this.context.intl'
class AnyComponent extends React.Component {
...
this.context.intl.formatMessage
...
}
AnyComponent.contextTypes = {
intl: React.PropTypes.object
};
See https://facebook.github.io/react/docs/context.html for more info on how context works
I'm nervous about doing this. At least with injectIntl, it's extremely clear what's happening.