react-blocker

1.2.1 • Public • Published

react-blocker

USAGE

You should ready this babel-plugin-transform-decorators-legacy

then....

npm install react-blocker --save

 
import reactBlocker from 'react-blocker';
 
 
@reactBlocker((props) => {
  // handle props and return a valid react element
  return (<div>you are blocked</div>)
})
class Example extends React.Component {
 
  render() {
    return (
      <div>
        hello world
      </div>
    );
  }
}
 
render(<Example />, document.getElementById('root'));
 

Or you can use object as arguments

 
@reactBlocker({
  componentWillMount() {},
  componentWillReceiveProps() {},
  blockFunc(props){
    return (<div>you are blocked</div>)
    // this is equivalent to the just use a function as a argument
  }
})

Readme

Keywords

Package Sidebar

Install

npm i react-blocker

Weekly Downloads

0

Version

1.2.1

License

MIT

Last publish

Collaborators

  • lyf1999