react-ref
👉 Set reference to an element in React components
Made with ❤ at @outlandish
Install
API
npm install --save react-ref
CLI
npm install --global react-ref
Import
// ES6
// CommonJSvar ref =
Usage
ref(instance, name)
- instance {Object} React component
- name {String} Name of property to attach element reference
Returns a function.
Example:
Component { thisinput } { thisinputvalue = '' } { return <div className='Input'> <input type='text' ref= /> </div> }
Contributing
All pull requests and issues welcome!
If you're not sure how, check out Kent C. Dodds' great video tutorials on egghead.io!
Author & License
react-ref
was created by Sam Gluck and is released under the MIT license.