0.0.7 • Published 7 years ago

react-context-io v0.0.7

Weekly downloads
10
License
MIT
Repository
github
Last release
7 years ago

react-context-io

Naive implementation of rfcs#89.

Installation

$ npm i react-context-io

Or

$ yarn add react-context-io

Usage

import React, { useContext } from 'react';
import { createContextIO } from 'react-context-io';

const CountStore = createContextIO(0);

const Result = () => {
  const count = useContext(CountStore);
  return <div>{count}</div>;
};

const AddButton = () => (
  <button onClick={() => CountStore.write(count => count + 1)}>+</button>
);

const Counter = () => (
  <CountStore.Provider>
    <Result />
    <AddButton />
  </CountStore.Provider>
);

Live demo

License

MIT

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago