react-with-hooks-odgn

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i react-with-hooks-odgn

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

16.4 kB

Total Files

5

Last publish

Collaborators

  • odogono