From dcdaeb1f88b19a13b8ff6efd6266075879b92f40 Mon Sep 17 00:00:00 2001 From: Nowreen Chowdhry Date: Fri, 16 Nov 2018 14:33:35 -0800 Subject: [PATCH] Remove deprecated isMounted() --- ampersand-react-mixin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ampersand-react-mixin.js b/ampersand-react-mixin.js index f3964d8..e1642aa 100644 --- a/ampersand-react-mixin.js +++ b/ampersand-react-mixin.js @@ -17,7 +17,7 @@ var deferbounce = function (fn) { }; var safeForceUpdate = function () { - if (this.isMounted()) { + if (this._isMounted) { this.forceUpdate(); } }; @@ -45,6 +45,7 @@ module.exports = events.createEmitter({ }, componentDidMount: function () { + this._isMounted = true; var watched = this.getObservedItems && this.getObservedItems(); if (watched) { forEach(watched, this.watch, this); @@ -55,6 +56,7 @@ module.exports = events.createEmitter({ }, componentWillUnmount: function () { + this._isMounted = false; this.stopListening(); } });