react-pos

0.1.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i react-pos

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • knape