Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maliyshock opened this issue Jan 24, 2020 · 1 comment

Comments

@maliyshock
Copy link

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.

@theKashey
Copy link
Collaborator

hot creates a "boundary" around given component. Usually you don't need to pass any props via those boundaries (and usually you have to wrap only your top level component)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants