The Panda Post. Check out some useful code snippets, emulation fun, or just random tech stuff.

React 16.3 and createRef()

React 16.3 has been released:

We now have a new way of accessing refs, instead of the previous callback function. Per React’s docs, this is how it is done:

class MyComponent extends React.Component {
    constructor(props) {
        this.myRef = React.createRef();
    render() {
        return <div ref={this.myRef} />;