dom-location

1.0.1 • Public • Published

dom-location

React hook for subscribing to window size

Note: This is using the new React Hooks API Proposal which is subject to change until React 16.7 final.

You'll need to install react, react-dom, etc at ^16.7.0-alpha.0

Install

yarn add dom-location
 

or

npm i -s dom-location
 

Usage

 
import useDomLocation from 'dom-location';
 
function App() {
  let element = document.getElementsByTagName('body')[0];
  let obj = useDomLocation(element);
  console.log(obj);
  return (
    <div>
      <h1>{111}</h1>
    </div>
  );
}
 
ReactDOM.render(<App />, window.root);

Readme

Keywords

none

Package Sidebar

Install

npm i dom-location

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

2.63 MB

Total Files

9

Last publish

Collaborators

  • liwusen