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 に対応する属性がなかった場合に発生した。タイポ注意。

参考

エッセンシャル思考 最少の時間で成果を最大にする
[ad] エッセンシャル思考 最少の時間で成果を最大にする
グレッグ・マキューン, 高橋璃子 (Kindle版)