Generally confused on when to put logic in app or component

Hi,

This isn’t a specific problem, but more of just a question. When following along with the tutorials, it seems that certain components require a large portion of the logic to be in the app.tsx file. However, a lot of other components contain all of their logic in their respective file. An example is the alert function which has most of the logic in the app, while the expandible text has the logic in the component. I was just wondering when the logic would be in the app or in the component, and how to figure it out

I had the same question a while ago, but as you go through the course you will start to understand that we have the logic in the app component when there is no specific feature that the component has, for example a button component…

If you have a button component you wouldn’t want it to do the same thing every time, sometimes you want the button to submit a form and sometimes you want it to display an alert so the logic is dependent on what you want the component to do, so the logic should be in the parent component

But, in the case of the Expandable Text component the component will do the same thing everytime so, the logic should be inside the component itself.

in Summary :- we have the logic inside the component if the component has one specific job that it has to do, but if we want the component to different things depending on where we put it then the logic should be in the app component…

Please consider that I’m still a beginner with react and this is as far as I know

Thank you…