How can the status of child components be obtained in real time in the parent component of React?

there is a state in the child component that needs to be used in the parent component, so how can the parent component respond in real time?

the only way you can think of is to use callbacks to get the status of child components directly from the parent component. For example, what is obtained by using this.refs.xxx.state.xxx is not real-time, can it be obtained in real-time? Like redux, can you respond in real time without additional processing?

Aug.25,2021

check getChildContext


 

you don't want to use callbacks, nor do you want to use refs . Then you'll have to use redux .
in the child component, hand over state directly to redux . It would be nice to get the parent component directly from redux .

in addition, your refs is not real-time data. I guess there is something wrong with you. This shouldn't be. The data obtained by
refs is the current state of the component it points to.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c72e-2c2f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c72e-2c2f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?