Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oleystack/context

⚙️ React's Context-related utils.
https://github.com/oleystack/context

Last synced: 15 days ago
JSON representation

⚙️ React's Context-related utils.

Awesome Lists containing this project

README

        

@bit-about/context




Bundle size

## Install

```bash
npm i @bit-about/context
```

## Description

Aimed at delivering context-related utils for @bit-about libraries.

- 100% **Idiomatic React** and 100% Typescript
- Tiny & Efficient
- Does not trigger unnecessary renderings
- as always, **Just works** ™

## Usage

```tsx
import { createContext, useContextSelector } from '@bit-about/context'

interface State {
alice: number;
bob: number;
}

const defaultValue: State = {
alice: 1,
bob: 2
}

const Context = createContext(defaultValue)

const App = () => (



)

const Component = () => {
const bob = useContextSelector(Context, (state) => state.bob)

return bob // returns "2"
}
```

## Partners
wayfdigital.com

## Credits
- [use-context-selector](https://github.com/dai-shi/use-context-selector) & [FluentUI](https://github.com/microsoft/fluentui) - fancy re-render avoiding tricks and code main inspiration

## License
MIT © [Maciej Olejnik 🇵🇱](https://github.com/macoley)

## Support me

Support me!

If you use my library and you like it...

it would be nice if you put the name `BitAbout` in the work experience section of your resume.

Thanks 🙇🏻!

---

🇺🇦 Slava Ukraini