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

@mantine/utils

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mantine/utils

A set of utils used in Mantine packages

  • 5.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
229K
increased by6.47%
Maintainers
1
Weekly downloads
 
Created

What is @mantine/utils?

@mantine/utils is a utility library that provides a collection of useful functions and hooks for React applications. It is part of the Mantine ecosystem, which is a set of tools and components designed to help developers build modern web applications with ease.

What are @mantine/utils's main functionalities?

useDebouncedValue

The useDebouncedValue hook allows you to debounce a value, which means it will only update after a specified delay. This is useful for scenarios like search input where you don't want to trigger a search on every keystroke.

import { useDebouncedValue } from '@mantine/hooks';

function MyComponent() {
  const [value, setValue] = useState('');
  const [debouncedValue] = useDebouncedValue(value, 200);

  useEffect(() => {
    // Do something with debouncedValue
  }, [debouncedValue]);

  return <input value={value} onChange={(e) => setValue(e.target.value)} />;
}

randomId

The randomId function generates a unique string identifier. This can be useful for creating unique keys for list items or other elements that require unique identifiers.

import { randomId } from '@mantine/utils';

const uniqueId = randomId();
console.log(uniqueId); // Outputs a unique string identifier

clamp

The clamp function restricts a number to be within a specified range. This is useful for ensuring that a value stays within a certain boundary.

import { clamp } from '@mantine/utils';

const clampedValue = clamp(10, 0, 5);
console.log(clampedValue); // Outputs 5

Other packages similar to @mantine/utils

Keywords

FAQs

Package last updated on 09 Sep 2022

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