X
X
xXRustamXx2018-11-22 15:25:25
JavaScript
xXRustamXx, 2018-11-22 15:25:25

Is this approach of rendering through setState normal?

And so let's say I have 4 components:

<App />
<Desks />
<Desk />
<DeskHead />

<App />is responsible for rendering <Desks />, <Desks />in turn, is responsible for rendering <Desk />, and <Desk />for <DeskHead />
And, for example, in a component, <DeskHead />I send some values ​​to the <App />component through parents on click to call the setState method and update some kind of state, is this considered good form or is it not possible to do this? if not, what are the alternatives?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-11-22
@xXRustamXx

If you need to update some state at the application level on a click in the header of one of the boards, then I think redux is better suited here.
In other cases, such as at the module level, lifting up state is considered good practice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question