// console报错信息以下 Warning: `value` prop on `input` should not be null. Consider using the empty string to clear the component or `undefined` for uncontrolled components. in input (created by AddAddress) in div (created by AddAddress) in div (created by AddAddress) in AddAddress (created by RouterContext) in div (created by Unknown) in div (created by Unknown) in Unknown (created by RouterContext) in RouterContext (created by Router) in Router
缘由解析:react
因为input须要设置value,而初始化state里面的value值为null,致使react解析报Waring。ide
Warning: `value` prop on `input` should not be null. Consider using the empty string to clear the component or `undefined` for uncontrolled components.post
解决方案:code
一、waring忽略无论component
二、设置input初始化值位空字符串blog
<input type="number" maxLength="6" placeholder="选填" value={postcode || ''} />字符串