created: 2021-02-17T06:07:25.000Z

Formikで A component is changing an uncontrolled input of type text to be controlled

Formik を使ったらこのエラーが出た。

Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components

これは操作した input#nameinitialValue に対応する属性がなかった場合に発生した。タイポ注意。

参考

UXデザインの法則 ―最高のプロダクトとサービスを支える心理学
[ad] UXデザインの法則 ―最高のプロダクトとサービスを支える心理学
Jon Yablonski, 相島 雅樹 (単行本(ソフトカバー))