Skip to content

Commit

Permalink
fix: fix boolean handling in react wrapper (#2547)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Lukas Spirig <[email protected]>
  • Loading branch information
jeripeierSBB and kyubisation authored Apr 4, 2024
1 parent 5e8d0b2 commit e4ba04b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/react/core/create-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ export const createComponent = <I extends HTMLElement, E extends EventNames = {}
reactProps[attributeName] = toAttribute ? toAttribute(v) : v;
} else if (v) {
reactProps[attributeName] = '';
// Some boolean props like `checked` don't react to mutations after user interaction.
// To ensure expectation from React/JSX, we set also the corresponding property in this case.
elementProps[k] = v;
} else {
elementProps[k] = v;
}
Expand Down

0 comments on commit e4ba04b

Please sign in to comment.