React is rendered twice in the component render (). The first rendering is successful, and the second return function is undefine.

when I was writing a login page.
< LoginForm icon="mobile" onChange= {() = > this.handleChange ()} / >

written in the parent component

use < input className="number-input" type= {filetype} onChange= {this.props.onChange} value= {this.state.value} / >
in the child component to get the value of the input box, and then write constuctor () {super (); this.state= {value:""}}

in the parent component.

but the console mistakenly says that value is empty, and then I set the value of the subcomponent to empty, give state.value a value in the controller, and I can print the value of state.value. Then I print the function this.props.onChange on return under render () {} in the subcomponent, and print it twice in the browser. Once it returns the undefine, returned by the function function,. Excuse me, what is the problem and how to solve it.

Mar.07,2021

  • parent component:
  

there is nothing wrong with this! Can print it out,

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