React.js setting value of input

后端 未结 7 1413
既然无缘
既然无缘 2020-12-14 07:51

I am a beginner with react.js and it\'s amazing but I am facing a real problem: I need to set the value of an input using plain and pure javascript but form some reason reac

7条回答
  •  半阙折子戏
    2020-12-14 08:40

    You should post your code in order to get a better/ more to your situation suited answer, but one think that will work is just setting the

    defaultValue
    

    instead of value of the input. Take a look at your browsers console, that's what react will log there.

    Depending on your code, you can set the states value onKeyUp or similar with a function or fetch the new inputs value when the form is submitted.

提交回复
热议问题