Skip to content

Creates a new ref callbacks, that updates ref arguments

Notifications You must be signed in to change notification settings

yachaka/react-combine-refs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-combine-refs

Creates a new ref callback, that updates ref arguments. A ref argument can be a function or an object with a .current property.

import combineRefs from 'react-combine-refs';

function MyComponent(
  props,
  refProp,
) {
  const myCustomRef = useRef(null);
  
  // ...
  
  return (
    <div ref={combineRefs(refProp, myCustomRef)}>
      // ...
    </div>
  );
}

About

Creates a new ref callbacks, that updates ref arguments

Resources

Stars

Watchers

Forks

Packages

No packages published