react-annotations

0.0.2-RC1 • Public • Published

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 .

Package Sidebar

Install

npm i react-annotations

Weekly Downloads

0

Version

0.0.2-RC1

License

MIT

Last publish

Collaborators

  • abdennour