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

The best use-hook ever made.

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

use-shit

NPM License npm bundle size

The best use-hook ever made.

Installation:

npm i use-shit

Usage

import { useShit } from 'use-shit';

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

const [shit] = useShit(REAL_SHIT); // shit === REAL_SHIT

Example 1

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 (
    <>
      <p>Thanks god, My code is beautiful!</p>
      <ul>
        { shit.map((slice) => (
          <li key={slice}>{slice}</li>
        )) }
      </ul>
    </>
  );
}

Example 2

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

MIT

Static Badge

Keywords

use

FAQs

Package last updated on 14 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts