# @flowrrs/create-context

> Simple utility to create context-bound React hooks.

Latest version **0.0.11** (published 2022-07-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @flowrrs/create-context
pnpm add @flowrrs/create-context
yarn add @flowrrs/create-context
bun add @flowrrs/create-context
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2022-07-12 |
| First published | 2022-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | flowrrs |
| Maintainers | imflowrrs |

## Links

- npm: https://www.npmjs.com/package/@flowrrs/create-context
- Repository: https://github.com/flowrrs/create-context
- Homepage: https://github.com/flowrrs/create-context#readme
- Issues: https://github.com/flowrrs/create-context/issues
- npm.io page: https://npm.io/package/@flowrrs/create-context

## Recent versions

- 0.0.11 (latest) — 2022-07-12
- 0.0.1 — 2022-07-12

## README

# @flowrrs/create-context

Simple utility to create context-bound React hooks.

## Install

```bash
npm install --save @flowrrs/create-context
```

## Usage

```jsx
import * as React from 'react'
import { createContextHook } from '@flowrrs/create-context'

const [FooProvider, useFooStore, FooContext] = createContextHook((providerProps) => {
  const [foo, setFoo] = React.useState('foo' + providerProps.suffix)
  return { foo, setFoo }
})

const App = () => {
  return (
    <FooProvider suffix="bar">
      <InnerApp />
    </FooProvider>
  )
}

const InnerApp = () => {
  const { foo, setFoo } = useFooStore()

  return (
    <div>
      <h1>{foo}</h1>
      <button onClick={() => setFoo(foo.toUpperCase())}>
        uppercase foo
      </button>
    </div>
  )
}
```

## License

MIT © [flowrrs](https://github.com/flowrrs)

---

This package was created using [create-react-hook](https://github.com/hermanya/create-react-hook).

---
_Source: https://npm.io/package/@flowrrs/create-context · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
