gaearon / gaearon/react-hot-loader

Child component methods not available to use via refs from the parent component

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

Description

If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.

### Description

What you are reporting: Bug.

### Expected behavior

What you think should happen: Child component methods should be available for use via refs from the parent component `this.childComponentRef.current.childMethod()`

### Actual behavior

What actually happens: `this.childComponentRef.current.childMethod()` throws error "childMethod is not a function", cas it is undefined.

If I replace this part
```
export default hot(withErrorBoundary(
childComponent,
ErrorBoundary,
));
```
To this
```
export default childComponent;
```
Child methods would be available by the parent component via ref

### Environment

React Hot Loader version: 4.8.5

Run these commands in the project folder and fill in their results:

1. `node -v`: v12.13.0
2. `npm -v`: 6.12.0

Then, specify:

1. Operating system: Mac Os High Sierra 10.13.4
2. Browser and version: Chrome 79.0.3945.117

### Reproducible Demo
Sorry guys. It will take a bunch of time to create a new project with environment end stuff.

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.