1.0.0 • Published 6 years ago

react-with-hooks-odgn v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

react-with-hooks

Ponyfill for the proposed React Hooks API.

Install

$ npm i odgn-react-with-hooks --save

Example

import withHooks, { useState, useEffect } from 'odgn-react-with-hooks';

const Counter = withHooks(() => {
  const [ count, setCount ] = useState(0);
  useEffect(() => {
    document.title = "count is " + count;
  })
  return (
    <div>
       {count}
       <button onClick={() => setCount(count + 1)}>+</button>
       <button onClick={() => setCount(count + 1)}>-</button>
    </div>
  );
});

Live Demo

API Reference

License

MIT