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

https://github.com/nainemom/use-shit

The best use-hook ever made.
https://github.com/nainemom/use-shit

fun hooks-api-react react use-hook vue3

Last synced: 11 months ago
JSON representation

The best use-hook ever made.

Awesome Lists containing this project

README

          

# use-shit

![NPM License](https://img.shields.io/npm/l/use-shit)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-shit)

> The best use-hook ever made.

## Installation:

```bash
npm i use-shit
```
## Usage
```ts
import { useShit } from 'use-shit';

const REAL_SHIT = [1, 2, 3, 4];

const [shit] = useShit(REAL_SHIT); // shit === REAL_SHIT
```
## Example 1
```tsx
import { useShit } from 'use-shit';

const REAL_SHIT = [1, 2, 3, 4];

function Component() {
- const shit = REAL_SHIT; // ❌ It's ugly
+ const [shit] = useShit(REAL_SHIT); // ✅ Nice and smooth

return (
<>

Thanks god, My code is beautiful!



    { shit.map((slice) => (
  • {slice}

  • )) }

>
);
}
```

## Example 2
```tsx
import { useShit } from 'use-shit';

function Component() {
const [num1, setNum1] = useState(0);
const [num2, setNum2] = useState(0);

- const sum = num1 + num2; // ❌ It doesn't look good
- const sum = useMemo(() => num1 + num2, [num1, num2]); // ❌ Unnessesury use of cache
+ const [sum] = useShit(num1 + num2); // ✅ Nice and feels right

return (
<>
setNum1(e.target.valueAsNumber)} />
setNum2(e.target.valueAsNumber)} />
{sum}
>
);
}
```

## License

[MIT](./LICENSE)

---

![Static Badge](https://img.shields.io/badge/don't-use_shit-green)