Can't type in React input text field

后端 未结 8 2242
无人共我
无人共我 2020-12-02 11:56

I\'m trying my first bit of React.js and am stumped early on... I have the code below, which renders a search form into

. B
8条回答
  •  再見小時候
    2020-12-02 12:27

    For me the following simple change worked perfectly

     setTxtLetter(event.target.value)} /> {/* does not work */}
    

    change... value={myPropVal} to... defaultValue={myPropVal}

     setTxtLetter(event.target.value)} /> {/* Works!! */}
    

提交回复
热议问题