Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

use-shit

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-shit - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+12
-0
CHANGELOG.md
# Changelog
## v0.0.4
[compare changes](https://github.com/nainemom/use-shit/compare/v0.0.3...v0.0.4)
### 🏡 Chore
- Update readme ([5e5d481](https://github.com/nainemom/use-shit/commit/5e5d481))
### ❤️ Contributors
- Amir Momenian <nainemom@gmail.com>
## v0.0.3

@@ -5,0 +17,0 @@

+1
-1
{
"name": "use-shit",
"version": "0.0.3",
"version": "0.0.4",
"description": "The best use-hook ever made.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -21,5 +21,4 @@ # use-shit

```
## Example
## Example 1
```tsx
import React from 'react';
import { useShit } from 'use-shit';

@@ -29,4 +28,5 @@

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

@@ -46,5 +46,24 @@ return (

If you are thinking why not just use the `REAL_SHIT`, you are not a true hook based developer. Althorugh `REAL_SHIT` is equal to `shit`, but it's always nice to have some unnessesury `useShit` in body of components.
## 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 (
<>
<input type="number" onChange={(e) => setNum1(e.target.valueAsNumber)} />
<input type="number" onChange={(e) => setNum2(e.target.valueAsNumber)} />
<b>{sum}</b>
</>
);
}
```
## License

@@ -51,0 +70,0 @@