Skip to content

Commit

Permalink
Fix reference to props in constructor
Browse files Browse the repository at this point in the history
In <=IE10, `this.props` is null, so when attempting to set the namespaces,
the reference to `this.props.ns` raises an exception. By updating the
reference to use the version passed into the constructor, we are
consistent with other usages of props on the constructor, and I've
confirmed this patch works in <=IE10 as well.
  • Loading branch information
Mark Faga committed Mar 21, 2018
1 parent fec5f5f commit 1503902
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/I18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class I18n extends Component {
super(props, context);

this.i18n = props.i18n || context.i18n || getI18n();
this.namespaces = this.props.ns || (this.i18n.options && this.i18n.options.defaultNS);
this.namespaces = props.ns || (this.i18n.options && this.i18n.options.defaultNS);
if (typeof this.namespaces === 'string') this.namespaces = [this.namespaces];

const i18nOptions = (this.i18n && this.i18n.options && this.i18n.options.react) || {};
Expand Down

0 comments on commit 1503902

Please sign in to comment.