1

We are refactoring some legacy code into React and it turns out it is all reactNative.

Does anyone have any idea how we can refactor this AppRegistry.registerComponent into React (Just regular React (like the one create-react-app installs), not React Native, not React-Web), the same goes for AppRegistry.getApplication? We don't want ANY react-native at all, so any help would be greatly appreciated...

Could someone also point me at a decent resource so I can stop asking these asinine questions? :(

2
  • 1
    By ReactJS you mean react for web? Commented Aug 9, 2022 at 21:07
  • Hi Youzef, Just regular React (like the one create-react-app installs), not React Native, not React-Web ;) Commented Aug 9, 2022 at 21:54

1 Answer 1

1

You will not need AppRegistry in your case. This is the entry point for your app in react native.

AppRegistry is the JS entry point to running all React Native apps. App root components should register themselves with AppRegistry.registerComponent, then the native system can load the bundle for the app and then actually run the app when it's ready by invoking AppRegistry.runApplication.

In your app, you should refactor

// react native app
import App from "./App";
...
AppRegistry.registerComponent(appName, () => App);

to

// your new app
import App from './App';
...
ReactDOM.render(<App />, document.getElementById('root'));
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for justifying my suspicions :) I thought that was the case, but it felt too easy... Guess I might know something after all :) You are right as well, we want to refactor out AppRegistry altogether, as it's all that's left over from React-Native/React-Native-Web, and we want to remove it... Thank you Youzef, you're a legend ;)
How does this work for runApplication and getApplication though, the same way?
These are methods of AppRegistry and won't be required in your app

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.