After the react parent component setState updates the data, the props passed to the child component is undefined

the updated value of the parent component is obtained from the child component, and then the updated value is passed to another child component
, but what you get is undefined, that is, you can get the value before the parent component is updated. After the update, the this.state you get in the render of the parent component is undefined

.

I probably know that the reason is in the life cycle, but I don"t know which step went wrong

this is the code of the parent component

clipboard.png

Mar.01,2021

e.texts make sure there is s ?


e.x I'm afraid it's not e.pageXpage.pageY


ask SideBar whether parameters are passed in the callback onChange function.
e = > this.props.onChange (e)


Thank you for your answers. The
problem has been solved. The value passed from the child component to the parent component is incorrect. I passed an object directly instead of passing the properties of the object.
although I don't know why when an object is passed directly to the parent component, when it is changed through setState, it will not be updated

this is the way to modify the forward value. After setState in the parent component, the value you get is undefined

.

clipboard.png

setState
clipboard.png


hi Hello I have the same problem, but I split the object to update the assignment and the subcomponent is not updated or the default object value


encountered a similar problem when using hook.
my is that the parent component passed past is the object array (state)
the last setState has to be deconstructed to be easy to use
reminds me that when react changes the object, it has to be passed into function

.
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-1e8364d-c51.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-1e8364d-c51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?