react-combine-refs

1.0.1 • Public • Published

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>
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i react-combine-refs

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

40.8 kB

Total Files

5

Last publish

Collaborators

  • yachaka