Skip to content

Hot reloading not working with components as functions #26498

Closed
@gbbarroso

Description

@gbbarroso

I just started a new project and it seems hot reload doesn't work when using components as functions, however it works when changing it to a class that extends React.Component

React Native version: 0.60.5

info Fetching system and libraries information...
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Memory: 7.19 GB / 15.88 GB
Binaries:
Node: 10.15.3 - C:\Program Files\nodejs\node.EXE
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5314842

Steps To Reproduce

  1. react-native init myproj
  2. cd ./myproj
  3. react-native run-android
  4. Enable hot reload on app
  5. Change some Text on App.js and save it
  6. Hot reload's tooltip shows up, but no changes are applied
  7. Refactor App function into a class that extends from React.component and move into a render() method.
  8. Hot reloading is now working.

Describe what you expected to happen:
From what I understand it should work for functions components as well, I was reading into react hooks documentations and it even said it would make things easier for hot reloading.

Snack, code example, screenshot, or link to a repository:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions