Wondering what’s next for npm?Check out our public roadmap! »

    react-unmount-listener-mixin

    1.0.2 • Public • Published

    react-unmount-listener-mixin

    React mixin for listenable componentWillMount. 729 bytes uncompressed, 381 bytes compressed.

    var ReactUnmountListenerMixin = require('react-unmount-listener-mixin');
     
    React.createClass({
      mixins: [ReactUnmountListenerMixin],
     
      componentDidMount: function() {
        // perform request, abort on componentWillUnmount
        this.addUnmountListener(abortRequestFunction);
      },
      handleClickAbort: function() {
        // abort request, stop listening to componentWillUnmount
        this.removeUnmountListener(abortRequestFunction);
      },
      ...
    });

    Install

    npm i react-unmount-listener-mixin

    DownloadsWeekly Downloads

    3

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • avatar