node.js - antdesign的Input控件加了初始化值,网站控制台暴警告,什么原因?
巴扎黑
巴扎黑 2017-04-17 14:45:12
0
2
713


这句话爆了警告

即:Warning: Input is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlle...
如果,我在initailValue传入不变的量string,就不会暴警告

为什么 呢?

巴扎黑
巴扎黑

reply all(2)
PHPzhong

I also have this problem, because it’s just a warning, not an error, and it doesn’t affect development, so I don’t care

巴扎黑

The last link in the error you reported mentioned: A controlled <input> has a value prop. In your code, the value attribute does not appear.

Putting the execution result of a function into input is personally undesirable. You should save the execution result of this function in a variable in advance, and then put the variable into input, just like formItemLayout. I think this is better

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!