Skip to content

caasi/react-notify-mixin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-notify-mixin

A mixin to notify the top level component.

Usage

First, create a component with this mixin:

var NotifyMixin = require('react-notify-mixin');
var MyComp = React.createClass({
  mixins: [NotifyMixin],
  handleClick: function () {
    this.notify('hello');
  },
  render: function () {
    return <button onClick={this.handleClick}>click me!</button>
  }
});

And bury it inside your app:

var MyApp = React.createClass({
  render: function () {
    return {
      <div>
        <div>
          <MyComp />
        </div>
      </div>
    }
  }
});

Then get the notification on the top:

React.render(
  <MyApp onNotify={function (msg) { doSomething(msg); }} />,
  document.getElementById('app-id')
);

About

A mixin to notify the top level component.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published