← Blog

How to enable Hot Reloading in React Native

React Native1 min read

By default Hot Reloading in React Native only works if you extend React.Component. If you are using your own base classes to inherit from you need to change the .babelrc file.

Below is my working example. In the superClasses section you will see BasePanel and InfoPanel which are my base classes.

{
 "presets": ["babel-preset-expo"],
 "env": {
  "development": {
    "plugins": [
      ["react-transform",
        {
          "transforms": [{
             "transform": "react-transform-hmr",
             "imports": ["react"],
             "locals": ["module"]
           }],
          "superClasses": ["BasePanel", "InfoPanel", "React.Component", "Component"]
        }
      ]
     ]
    }
  }
}

Stuck on something like this?

I help businesses and agencies with WordPress, WooCommerce and JavaScript problems, from one-off fixes to ongoing support.