New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-beautiful-hooks-library

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-beautiful-hooks-library

Super useful react + ts hooks all in one place

latest
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

react-beautiful-hooks-library

Super useful react + ts hooks all in one place

Installation

Install this package with npm

  npm i react-beautiful-hooks-library

Hooks list

useDebounce

Delays updating a value until a specified amount of time has passed

import {useDebounce} from 'react-beautiful-hooks-library'

export default function App() {
    const func = () => {
        console.log("this needs to be debounced");
    }
    const debouncedFunction = useDebounce(func, 100);
  return (<YourComponents />);
}

useBroadcastChannel

Leverages the BroadcastChannel API to enable real-time communication between different tabs or windows of the same origin

import {useBroadcastChannel} from 'react-beautiful-hooks-library'

export default function App() {
    const {messages, sendMessage, isConnected} = useBroadcastChannel("channel name")
  return (<YourComponents />);
}

useRefCallback

Combines useRef and useCallback to dynamically assign and track a reference (ref) to a DOM element or component instance. It is useful when you need to perform actions when a ref changes

import {useRefCallback} from 'react-beautiful-hooks-library'

export default function App() {
    const [message, sendMessage] = useState("");
    const func = () => {
        setMessage("hello world");
    }
    const refCallbackFunc = useRefCallback(func, [message]);
  return (<YourComponents onClick={refCallbackFunc} />);
}

usePrevious

Tracks the previous value of a state.

import {usePrevious} from 'react-beautiful-hooks-library'

export default function App() {
  const [count, setCount] = useState(0);
  const prevCount = usePrevious(count);

  return (
    <div>
      <p>Current: {count}</p>
      <p>Previous: {prevCount ?? "N/A"}</p>
      <button onClick={() => setCount((prev) => prev + 1)}>Increment</button>
    </div>
  );
}

usePolling

Executes polling for a given function

import {usePolling} from 'react-beautiful-hooks-library'

function App() {
  const { start, pause, stop, result } = usePolling(async () => {
    await new Promise(resolve => setTimeout(resolve, 1000)); // Simulating async delay
    return "hello";
  }, 5000);

  useEffect(() => {
    start();
    return () => stop();
  }, []);

  return (
    <>
      <h1>{result}</h1>
      <button onClick={pause}>Pause</button>
      <button onClick={start}>Resume</button>
      <button onClick={stop}>Stop</button>
    </>
  );
}

export default App;

FAQs

Package last updated on 24 Mar 2025

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