T
T
tron212021-12-13 19:03:29
JavaScript
tron21, 2021-12-13 19:03:29

How to properly work with components in React?

Good day to all! I have a question, perhaps a theoretical one.

I wanted to learn how to correctly form components in React and what exactly of them (useState, useEffect, functions, etc.) should be transferred to the App component. Before that, I did mostly small, educational projects where a maximum of 3 pages. There I moved all the useState , functions and effects to the main App component. And now I'm busy with a project with a lot of pages and information, and moving all the states, functions and effects to the App seems redundant.

Please tell me how it is right and what to transfer to the App component from all the others, and what to leave in these components. What kind of useState, useEffcet and functions are best done in the main parent component, and what can be left in its native component.
Thanks in advance for your reply and tips!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profesor08, 2021-12-13
@profesor08

moved all useState , functions and effects to the main App component

This is not taught.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question