🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-merge-refs

Package Overview
Dependencies
Maintainers
1
Versions
10
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.

1.1.0
Source
npm
Version published
Weekly downloads
1.1M
-5.56%
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

react

FAQs

Package last updated on 27 Jul 2020

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