React Native - What is the difference between those two apps in which one is using the...












0















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?










share|improve this question

























  • 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
















0















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?










share|improve this question

























  • 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














0












0








0








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












2 Answers
2






active

oldest

votes


















2














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().






share|improve this answer
























  • 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 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



















2














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.






share|improve this answer


























  • 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 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











  • 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











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
});


}
});














draft saved

draft discarded


















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









2














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().






share|improve this answer
























  • 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 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
















2














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().






share|improve this answer
























  • 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 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














2












2








2







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().






share|improve this answer













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().







share|improve this answer












share|improve this answer



share|improve this answer










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 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



















  • 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 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

















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













2














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.






share|improve this answer


























  • 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 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











  • 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
















2














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.






share|improve this answer


























  • 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 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











  • 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














2












2








2







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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 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











  • 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













  • 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











  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks