React - change input defaultValue by passing props

后端 未结 7 2015
星月不相逢
星月不相逢 2020-12-24 13:02

Consider this example:

var Field = React.createClass({
    render: function () {
        // never renders new value...
        return (
            

        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 13:44

    You can make the input conditionally and then every time you want to force an update of the defaultValue you just need to unmount the input and then immediately render it again.

提交回复
热议问题