N
N
Nikita Kravchenko2020-06-01 22:51:58
React
Nikita Kravchenko, 2020-06-01 22:51:58

How to organize the appearance of components based on listeners?

Inside CEF, react is used. Listeners are hung on the client and catch everything that comes from the server. It is necessary, depending on what the server is sending, to show the required component, possibly several components.
How to properly organize the react application logic so that there are no problems with expanding the project in the future.
I am a beginner and have already broken my head on how to properly catch and show / hide a component.
In which file/files to place all listeners and show/hide components.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yustas Alexu, 2020-06-02
@nkdev55

In the parent component, we set listeners and create a state (state). When catching an event, we change the state. We pass the state through props to the child components and, according to the condition tied to the state from the parent, hide or show what is needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question