size-decorator

0.0.1 • Public • Published

react size decorator,

adds width and height props to component (also recalculates this props on resize)

install

npm install --save size-decorator

usage

import size from 'size-decorator';
@size()
export default class MySuperComponent extends Component {
  constructor(props) {
    super(props);
  }
 
  render() {
    console.log(this.props.width, this.props.height)
    return (<div style={{width: 100, height: 100}}>HELLO</div>);
  }
}

or if you want width and height parameters on server

@size({width: 100, height: 200})

Package Sidebar

Install

npm i size-decorator

Weekly Downloads

3

Version

0.0.1

License

MIT

Last publish

Collaborators

  • istarkov