React Native - What is the difference between those two apps in which one is using the...
I recently moved to react native
and created a small application and it works just fine, so, i further start exploring the react native
.
I found the AppRegistry
api and i don't use this api in my existing app but my app is working fine then why to use the AppRegistry.registerComponent
.
What is the purpose of using it if apps works just fine without using it. What is the difference between those two apps in which one is using the AppRegistry.registerComponent
and another don't. A little real world example will be more appreciated. Thanks !!!
Edited:
I did a bit of research on it and found that everyone is saying it is used to register a component
and that's it, what kind of registration it is, what is meant by register a component
, what it is all about?
android ios reactjs react-native
add a comment |
I recently moved to react native
and created a small application and it works just fine, so, i further start exploring the react native
.
I found the AppRegistry
api and i don't use this api in my existing app but my app is working fine then why to use the AppRegistry.registerComponent
.
What is the purpose of using it if apps works just fine without using it. What is the difference between those two apps in which one is using the AppRegistry.registerComponent
and another don't. A little real world example will be more appreciated. Thanks !!!
Edited:
I did a bit of research on it and found that everyone is saying it is used to register a component
and that's it, what kind of registration it is, what is meant by register a component
, what it is all about?
android ios reactjs react-native
Have you been using Expo for making react native projects ?
– Suraj Malviya
Nov 28 '18 at 8:13
i am using the native development method, not expo
– Purple Bytes
Nov 28 '18 at 8:29
add a comment |
I recently moved to react native
and created a small application and it works just fine, so, i further start exploring the react native
.
I found the AppRegistry
api and i don't use this api in my existing app but my app is working fine then why to use the AppRegistry.registerComponent
.
What is the purpose of using it if apps works just fine without using it. What is the difference between those two apps in which one is using the AppRegistry.registerComponent
and another don't. A little real world example will be more appreciated. Thanks !!!
Edited:
I did a bit of research on it and found that everyone is saying it is used to register a component
and that's it, what kind of registration it is, what is meant by register a component
, what it is all about?
android ios reactjs react-native
I recently moved to react native
and created a small application and it works just fine, so, i further start exploring the react native
.
I found the AppRegistry
api and i don't use this api in my existing app but my app is working fine then why to use the AppRegistry.registerComponent
.
What is the purpose of using it if apps works just fine without using it. What is the difference between those two apps in which one is using the AppRegistry.registerComponent
and another don't. A little real world example will be more appreciated. Thanks !!!
Edited:
I did a bit of research on it and found that everyone is saying it is used to register a component
and that's it, what kind of registration it is, what is meant by register a component
, what it is all about?
android ios reactjs react-native
android ios reactjs react-native
edited Nov 28 '18 at 8:00
Purple Bytes
asked Nov 28 '18 at 7:28
Purple BytesPurple Bytes
618
618
Have you been using Expo for making react native projects ?
– Suraj Malviya
Nov 28 '18 at 8:13
i am using the native development method, not expo
– Purple Bytes
Nov 28 '18 at 8:29
add a comment |
Have you been using Expo for making react native projects ?
– Suraj Malviya
Nov 28 '18 at 8:13
i am using the native development method, not expo
– Purple Bytes
Nov 28 '18 at 8:29
Have you been using Expo for making react native projects ?
– Suraj Malviya
Nov 28 '18 at 8:13
Have you been using Expo for making react native projects ?
– Suraj Malviya
Nov 28 '18 at 8:13
i am using the native development method, not expo
– Purple Bytes
Nov 28 '18 at 8:29
i am using the native development method, not expo
– Purple Bytes
Nov 28 '18 at 8:29
add a comment |
2 Answers
2
active
oldest
votes
The AppRegistry specifies delegates the actual communication between the JS and native by letting the native application know about the JS entry point and many other information about the application resources that the bundle should know. It exposes various methods that helps in the delegation like spawning of a background service in android using the registerHeadlessTask
and startHeadlessTask()
.
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
1
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
1
If you go toindex.js
in your project root then you will get to see that by default there is an import fromApp.js
which is actual root component of you application that is being registered to the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:34
|
show 6 more comments
AppRegistry.registerComponent
is used to register your root component of the app. Its just like void main in java class. If you are using an expo project you will not see this line because expo does everything by itself without letting us see how actually things work in native environments. Everything that you write in app.js will be taken as entry point of your app.
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
This Api only works in projects created withreact-native init
. Have you created it with Create React Native App.?
– avani kothari
Nov 28 '18 at 8:38
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53514224%2freact-native-what-is-the-difference-between-those-two-apps-in-which-one-is-usi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The AppRegistry specifies delegates the actual communication between the JS and native by letting the native application know about the JS entry point and many other information about the application resources that the bundle should know. It exposes various methods that helps in the delegation like spawning of a background service in android using the registerHeadlessTask
and startHeadlessTask()
.
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
1
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
1
If you go toindex.js
in your project root then you will get to see that by default there is an import fromApp.js
which is actual root component of you application that is being registered to the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:34
|
show 6 more comments
The AppRegistry specifies delegates the actual communication between the JS and native by letting the native application know about the JS entry point and many other information about the application resources that the bundle should know. It exposes various methods that helps in the delegation like spawning of a background service in android using the registerHeadlessTask
and startHeadlessTask()
.
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
1
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
1
If you go toindex.js
in your project root then you will get to see that by default there is an import fromApp.js
which is actual root component of you application that is being registered to the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:34
|
show 6 more comments
The AppRegistry specifies delegates the actual communication between the JS and native by letting the native application know about the JS entry point and many other information about the application resources that the bundle should know. It exposes various methods that helps in the delegation like spawning of a background service in android using the registerHeadlessTask
and startHeadlessTask()
.
The AppRegistry specifies delegates the actual communication between the JS and native by letting the native application know about the JS entry point and many other information about the application resources that the bundle should know. It exposes various methods that helps in the delegation like spawning of a background service in android using the registerHeadlessTask
and startHeadlessTask()
.
answered Nov 28 '18 at 8:11
Suraj MalviyaSuraj Malviya
895415
895415
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
1
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
1
If you go toindex.js
in your project root then you will get to see that by default there is an import fromApp.js
which is actual root component of you application that is being registered to the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:34
|
show 6 more comments
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
1
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
1
If you go toindex.js
in your project root then you will get to see that by default there is an import fromApp.js
which is actual root component of you application that is being registered to the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:34
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #1: Let say i have component AppLogin and it is shown when the user is logging in to his account, and i register this component with the AppRegistry.registerComponent(), and have another component that is AppMain which is loaded always when the user successfully logged in to his account and will be always loaded when next time user will open the app because the user is already in active session of login.
– Purple Bytes
Nov 28 '18 at 8:20
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
Comment Part #2: So, when the app will be next time loaded on active session the AppRegistry.registerComponent() will contain the AppLogin but not AppMain but the user is logged in and AppMain is loaded, so, whether the AppRegistry.registerComponent() will target the AppMain or it will still targeting AppLogin which we don't need because the user is now logged in. What will be the scenario in that case?
– Purple Bytes
Nov 28 '18 at 8:27
1
1
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
@DhuBytes This does not goes like registering each of your UI components separately with the AppRegistry. You only register Your Application root component i.e. the root of your application in which the whole application will live. and then you make your application hierarchy using navigation. So with your use case there should be a root component say App, that will render a navigation stack containing your login and your AppMain. So your App is to be registered with the AppRegistry.
– Suraj Malviya
Nov 28 '18 at 8:28
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
So you mean the name which we initiate when doing the react-native init something, so, in that case the something is my root component? Can you please do a little example so i will accept your answer !!!
– Purple Bytes
Nov 28 '18 at 8:32
1
1
If you go to
index.js
in your project root then you will get to see that by default there is an import from App.js
which is actual root component of you application that is being registered to the AppRegistry.– Suraj Malviya
Nov 28 '18 at 8:34
If you go to
index.js
in your project root then you will get to see that by default there is an import from App.js
which is actual root component of you application that is being registered to the AppRegistry.– Suraj Malviya
Nov 28 '18 at 8:34
|
show 6 more comments
AppRegistry.registerComponent
is used to register your root component of the app. Its just like void main in java class. If you are using an expo project you will not see this line because expo does everything by itself without letting us see how actually things work in native environments. Everything that you write in app.js will be taken as entry point of your app.
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
This Api only works in projects created withreact-native init
. Have you created it with Create React Native App.?
– avani kothari
Nov 28 '18 at 8:38
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
|
show 2 more comments
AppRegistry.registerComponent
is used to register your root component of the app. Its just like void main in java class. If you are using an expo project you will not see this line because expo does everything by itself without letting us see how actually things work in native environments. Everything that you write in app.js will be taken as entry point of your app.
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
This Api only works in projects created withreact-native init
. Have you created it with Create React Native App.?
– avani kothari
Nov 28 '18 at 8:38
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
|
show 2 more comments
AppRegistry.registerComponent
is used to register your root component of the app. Its just like void main in java class. If you are using an expo project you will not see this line because expo does everything by itself without letting us see how actually things work in native environments. Everything that you write in app.js will be taken as entry point of your app.
AppRegistry.registerComponent
is used to register your root component of the app. Its just like void main in java class. If you are using an expo project you will not see this line because expo does everything by itself without letting us see how actually things work in native environments. Everything that you write in app.js will be taken as entry point of your app.
edited Nov 28 '18 at 8:32
answered Nov 28 '18 at 8:28
avani kothariavani kothari
1018
1018
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
This Api only works in projects created withreact-native init
. Have you created it with Create React Native App.?
– avani kothari
Nov 28 '18 at 8:38
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
|
show 2 more comments
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
This Api only works in projects created withreact-native init
. Have you created it with Create React Native App.?
– avani kothari
Nov 28 '18 at 8:38
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
I am not using expo, i am using the native development method
– Purple Bytes
Nov 28 '18 at 8:28
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
What if i don't use it?
– Purple Bytes
Nov 28 '18 at 8:29
This Api only works in projects created with
react-native init
. Have you created it with Create React Native App.?– avani kothari
Nov 28 '18 at 8:38
This Api only works in projects created with
react-native init
. Have you created it with Create React Native App.?– avani kothari
Nov 28 '18 at 8:38
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
no, i started from react-native init
– Purple Bytes
Nov 28 '18 at 8:40
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
Create React Native App makes it easy to start working on React Native apps by removing native code build tools from the equation.
– avani kothari
Nov 28 '18 at 8:41
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53514224%2freact-native-what-is-the-difference-between-those-two-apps-in-which-one-is-usi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you been using Expo for making react native projects ?
– Suraj Malviya
Nov 28 '18 at 8:13
i am using the native development method, not expo
– Purple Bytes
Nov 28 '18 at 8:29