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

react-merge-refs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-merge-refs

React utility to merge refs.

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
673K
decreased by-13.84%
Maintainers
1
Weekly downloads
 
Created

What is react-merge-refs?

The react-merge-refs package allows you to merge multiple React refs into a single ref. This is particularly useful when you need to pass multiple refs to a single DOM element or component.

What are react-merge-refs's main functionalities?

Merging Multiple Refs

This feature allows you to merge multiple refs into a single ref. In this example, ref1 and ref2 are merged into mergedRef, which is then passed to the div element.

const { useRef } = require('react');
const mergeRefs = require('react-merge-refs');

function MyComponent() {
  const ref1 = useRef();
  const ref2 = useRef();
  const mergedRef = mergeRefs([ref1, ref2]);

  return <div ref={mergedRef}>Hello World</div>;
}
0

Keywords

FAQs

Package last updated on 27 Jun 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