Last active
March 2, 2017 23:24
-
-
Save mikemunsie/4c8a658aa3512ef29e219d28ce9d3cdf to your computer and use it in GitHub Desktop.
React Mounted Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
export default class MountedComponent extends Component { | |
constructor(props) { | |
super(props); | |
const scope = this; | |
const componentWillUnmount = this.componentWillUnmount; | |
this.componentWillUnmount = function() { | |
this.setState = () => {}; | |
componentWillUnmount.apply(this, arguments); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment