Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sharper-react-utils

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharper-react-utils

A collection of React hooks to simplify your applications.

  • 1.0.0
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

React Utils

A collection of React hooks to simplify your applications.

Installation

npm install react-utils

Hooks

useDebounce

Description: The useDebounce hook delays updating the value until after a specified delay period has passed since the last value change. This is useful for limiting the rate of updates to expensive computations or API calls.

Usage Example:

import React, { useState } from 'react';
import useDebounce from 'react-utils/hooks/useDebounce';

const DebounceExample: React.FC = () => {
  const [inputValue, setInputValue] = useState('');
  const debouncedValue = useDebounce(inputValue, 500);

  return (
    <div>
      <input
        type="text"
        value={inputValue}
        onChange={(e) => setInputValue(e.target.value)}
        placeholder="Type something..."
      />
      <p>Debounced Value: {debouncedValue}</p>
    </div>
  );
};

useLocalStorage

Description: The useLocalStorage hook synchronizes a state variable with localStorage. It allows you to easily persist state between page refreshes.

Usage Example:

import React from 'react';
import useLocalStorage from 'react-utils/hooks/useLocalStorage';

const LocalStorageExample: React.FC = () => {
  const [name, setName] = useLocalStorage('name', '');

  return (
    <div>
      <input
        type="text"
        value={name}
        onChange={(e) => setName(e.target.value)}
        placeholder="Enter your name..."
      />
      <p>Your name is: {name}</p>
    </div>
  );
};

FAQs

Package last updated on 26 Oct 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc