Open jo32 opened 6 years ago
I can confirm the issue exists on version 3.18.4
Lines of code affecting it: https://github.com/developit/preact-compat/blob/3.18.4/src/index.js#L96-L101
You could temporary solve this problem by inverting logic after rendering, by calling this function on the react element:
function fixDefaultValueBug(element, props) {
const {value, defaultValue} = props;
if (defaultValue) {
if (!value && value !== 0) {
delete element.props.value;
element.props.defaultValue = defaultValue;
}
}
}
react: https://jsfiddle.net/jo32/85fgabqy/
vs
preact-compat: https://jsfiddle.net/jo32/0gzo34u6/