react-annotations
v0.0.2-RC1
Published
A "One Stop Shop" ( hub ) of React @Decorators!
Downloads
9
Maintainers
Readme
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 .