0.1.0 • Published 7 years ago

react-pos v0.1.0

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

React Pos

HoC for detecting changes of an element and return the new dimensions

Install the package from npm

npm install --save extract.js

Usage

Basic Example

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

const InnerContainer = reactPos()(({container}) => {
    const { bottom, height, left, right, top, width } = container;
    const stringContainer = JSON.stringify({
      bottom, height, left, right, top, width,
    }, null, 2);
    return (
      <div>{ stringContainer }</div>
    );
});


class App extends Component {

    render() {
        return (
            <InnerContainer />
        )
    }
}

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

TODO

  • Better documentation
  • Full test coverage

License

MIT. Copyright (c) 2016 Philip Knape.