https://github.com/catamphetamine/react-create-ref
React.createRef() polyfill
https://github.com/catamphetamine/react-create-ref
Last synced: 3 months ago
JSON representation
React.createRef() polyfill
- Host: GitHub
- URL: https://github.com/catamphetamine/react-create-ref
- Owner: catamphetamine
- Created: 2018-07-27T20:53:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-04T10:32:01.000Z (over 6 years ago)
- Last Synced: 2025-01-11T01:48:17.315Z (5 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
`React.createRef()` polyfill for React < 16.3
Install
=======```sh
npm install react-create-ref --save
```Use
===Calls native `React.createRef()` if it's available (React >= 16.3), calls the polyfill function otherwise (React < 16.3).
```js
import createRef from 'react-create-ref'class Example extends React.Component {
constructor() {
this.input = createRef()
}render() {
return (
this.input.current.focus()} />
)
}
}
```