On the Writing of react-native entry File

after using a react-native init project, its entry file is written as follows

import { AppRegistry } from "react-native";
import App from "./App";

AppRegistry.registerComponent("app", () => App);

this is normal and conforms to my understanding of react. But today, I can see in a project that it can be written like this:

import App from "./src/app";

const app = new App();
The export in

app.js is not a react component, but a normal function. project address

I don"t understand why this piece can be written in this way., new App () has become an object.

Mar.18,2021

suggests flipping through the historical version. It should be
startApp which also supports this kind of functional call rn . This hook function


Under the

src/screens/index.js file, there is a function called registerScreens , which calls Navigation.registerComponent , while Navigation.registerComponent returns a generationWrapper and executes AppRegistry.registerComponent to register your screen component, so when new App , it actually executes AppRegistry.registerComponent .

related source code: registerScreen

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48e35-2722a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48e35-2722a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?