use-window

2.0.0 • Public • Published

Downloads Version Issues

Setting variables to the window with an awesome react hook 🎣

Example:


import React from "react";
import useWindow from "use-window";

export default function App() {
  const [count, setCount] = useWindow("count", 0);
  return (
    <div className="App">
      <h1>{count}</h1>
      <h1>{window.count}</h1>
      <button onClick={() => setCount(count + 1)}>increment</button>
    </div>
  );
}

Package Sidebar

Install

npm i use-window

Weekly Downloads

10

Version

2.0.0

License

ISC

Unpacked Size

1.79 kB

Total Files

3

Last publish

Collaborators

  • jildert