# @grexie/compose

> Create and use composable functions for React context providers and other wrapper components.

Latest version **0.1.17** (published 2022-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @grexie/compose
pnpm add @grexie/compose
yarn add @grexie/compose
bun add @grexie/compose
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.17 |
| Published | 2022-11-16 |
| First published | 2022-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | tbehrsin |

## Links

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

## Recent versions

- 0.1.17 (latest) — 2022-11-16
- 0.1.16 — 2022-11-16
- 0.1.15 — 2022-11-16
- 0.1.14 — 2022-11-16
- 0.1.13 — 2022-11-16
- 0.1.12 — 2022-11-16
- 0.1.11 — 2022-11-16
- 0.1.10 — 2022-10-29
- 0.1.9 — 2022-10-29
- 0.1.8 — 2022-05-30
- 0.1.7 — 2022-03-11
- 0.1.6 — 2022-03-10
- 0.1.5 — 2022-03-10
- 0.1.4 — 2022-03-10
- 0.1.3 — 2022-03-10
- … 3 more at https://npm.io/package/@grexie/compose/versions

## README

# Grexie Compose

Create and use composable functions for React context providers and other wrapper components.

## Installing

```bash
yarn add @grexie/compose
```

## Usage

Create a composable from an existing component, for example a context provider:

```javascript
import { createComposable } from "@grexie/compose";

const withContextProvider = createComposable(ContextProvider);
```

Then use the composable with the `compose` function:

```typescript
import { compose } from "@grexie/compose";

const ComposedApp = compose(
  withContextProvider1,
  withContextProvider2,
  ...,
  withContextProviderN,
  App
);
```

You can chain as many composables together in the call to compose, avoiding the need to chain multiple JSX tags together to compose the App wrapper.

Or alternatively, if your composable function takes props in addition to children:

```typescript
import { createComposableWithProps, compose } from "@grexie/compose";

const withContextProvider1 =
  createComposableWithProps<PropsType>(ContextProvider);

const ComposedApp = compose(
  withContextProvider1({ ...props }),
  withContextProvider2,
  ...,
  withContextProviderN,
  App
);
```

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