Uncontrolled select support?
See original GitHub issueHi, the defaultValue attribute for <select>
does not work in preact: https://stackblitz.com/edit/preact-bug-defaultvalue-zn7r9a .
Switching to a selected attribute (in <option>
) seems to work but causes some strange behaviour on late renderings (no sandbox yet).
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Uncontrolled Components - React
In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by...
Read more >A component is changing the uncontrolled value state of ...
It's considered controlled if the value is not undefined . The value for Select should be selected using the value ticket?.status when list ......
Read more >Controlled vs. uncontrolled components in React
In this tutorial, we'll explain the difference between controlled and uncontrolled components in React with practical examples.
Read more >Controlled & Uncontrolled Components in React - Opcito
An Uncontrolled component stores its own state internally, and we have to query the DOM with the help of a ref to find...
Read more >Controlled vs Uncontrolled Components in React - ITNEXT
React supports two types of components: controlled components and uncontrolled components. The React docs state: In most cases, we recommend using ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To be clear for anyone looking to work on this,
defaultValue
on<select>
is not a DOM prop (MDN) but is something React supports, so support fordefaultValue
on<select>
needs to be inpreact/compat
.<option>
does have adefaultSelected
property (MDN), but not sure what React does with this.Hi, i just encountered this bug with defaultvalue on the select and i have a stackblitz example here: https://stackblitz.com/edit/preact-starter-template-yktscr?file=App.jsx. I used
defaultValue
on the select, but no luck. Or am I missing something?