0.0.2-RC1 • Published 7 years ago

react-annotations v0.0.2-RC1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Build Status Coverage Status

Overview :

This package aims to be as a hub of react annotations where community gathers all react decorators/annotations here.

It includes also a mature decorators existing in the open-source community. as well as new decorators that are built in this packages (like logger).

Install

npm install react-annotations --save;

Available annotations:

- @Autobind
- @ClickedOutside
- @Log
- @LogArgs
- @LogMethodName
- @LogReturned

Example :

import React, {Component} from 'react';
import {ClickedOutside, Autobind} from 'react-annotations';

@ClickedOutside
@Autobind
class Item extends Component {

   handleClickOutside() {
     this.setState({status: 'initial'});
   }

   render() {
     return (
      <div>
          {(this.state.status ==='initial') ?'' : <span>Salam</span> }
      </div>
    );
   }   
}

License:

MIT .