1.0.2 • Published 7 years ago

size-report v1.0.2

Weekly downloads
4
License
MIT
Repository
-
Last release
7 years ago

size-report

React component Code borrowed from a blog post by backalleycoder.com.

Install

npm install react-size-report

Example

import React, { Component } from 'react';
import { render } from 'react-dom';

class App extends React.Component {
  state = {
    width: 0,
    height: 0,
  }

  handleChange({ width, height }) {
    this.setState({
      width,
      height,
    });
  }

  render() {
    const { width, height } = this.state;
    return (
      <div>
        <p>width: {width}px, height: {height}px</p>
        <SizeReport
          onChange={::this.handleChange}
          style={{
            resize: 'both',
            width: '100px',
            border: '1px solid black',
            overflow: 'scroll',
          }}
        >
          You can resize me!
        </SizeReport>
      </div>
    );
  }
}

render(<App />, document.getElementById('container'));
1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago