react-with-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

react-with-hooks

Build Status codecov

Ponyfill for the proposed React Hooks API.

Works on RN!

Install

$ npm i react-with-hooks --save

Example

import withHooks, { useState, useEffect } from '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

/react-with-hooks/

    Package Sidebar

    Install

    npm i react-with-hooks

    Weekly Downloads

    2,776

    Version

    1.1.6

    License

    MIT

    Unpacked Size

    30.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • yesmeck