recently encountered some problems in the process of learning react.js. Go to the code diagram first:
inputonChangestate,stateinputvalue. consolestateinputvalue,...
state,,,.
this picture, which obtains the real-time value, fetched by input directly from the event event of the event, does not have this problem.
so I don"t understand why this round of transactions in react should have ended after the execution of setState, the state of the component has been updated, why does it console the value of the previous round? Look forward to the boss"s answer.
ps: aside: why bind state, to the value of input? I think it"s okay not to bind it. Users can enter it normally and just need an onChange event to update state.