gaearon / gaearon/react-hot-loader

hot:parent component can not get the instance of its child

Open
#1,183 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
775
PR merge metrics
No merged PRs in 30d

Description

I want to get this.testRef.current, but parent.js can not get 'this' of child.js.
Thanks for help.

parent.js:
```
import React, { Component } from 'react';
import { Button } from 'antd'
import Test from './Child';
export default class EditPage extends Component {
constructor(props) {
super(props)
this.testRef=React.createRef();
}
render(){
return (


console.log(this.testRef.current)}>click me


)
}
}
```

child.js
```
import React, { Component } from 'react';
import { hot } from 'react-hot-loader/root';

class Child extends Component {
constructor(props) {
super(props);
this.ref = React.createRef();
}

render() {
return (


please input


)
}
}
export default hot(Child);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.