Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the input doesnt work when generated by React

This input work correct, when i just add it to the index.html. But it doesnt work when generated by react. The nums in input form just dont changing. Why is this happening?

<input type="date" name="date" value="2003-12-16" max="2021-07-03"/>
like image 419
erikmikoyan2003 Avatar asked Jul 10 '26 09:07

erikmikoyan2003


1 Answers

To achieve your goal you have go with React way (Controlled Components):

<input type="date" value={this.state.value} onChange={this.handleChange} max="2021-07-03" />

Working demo: Codesandbox

To know about Uncontrolled Components please visit: Uncontrolled Components

like image 131
Rashed Rahat Avatar answered Jul 13 '26 20:07

Rashed Rahat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!