Skip to content

Instantly share code, notes, and snippets.

@mikemunsie
Last active March 2, 2017 23:24
Show Gist options
  • Save mikemunsie/4c8a658aa3512ef29e219d28ce9d3cdf to your computer and use it in GitHub Desktop.
Save mikemunsie/4c8a658aa3512ef29e219d28ce9d3cdf to your computer and use it in GitHub Desktop.
React Mounted Component
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