[v6.0.6] Bug: Checkboxes are always being cast to strings despite providing boolean default value.
See original GitHub issueDescribe the bug I’m trying to use react-hook-form with checkboxes and even though the default values for said checkboxes are all booleans (false), as soon as I interact with the checkbox the form value gets cast to a string. I was able to reproduce this fully in the codesandbox below.
To Reproduce
- Create checkbox components with default values that are booleans
- watch the values
- check them and you will see that they are cast to strings.
Codesandbox link (Required) https://codesandbox.io/s/react-hook-form-checkboxes-get-cast-to-strings-everytime-lioo1?file=/src/index.js
Expected behavior
I expect the checkboxes to not get cast into strings and simply change from true
to false
and vice versa.
Screenshots
@bluebill1049 it seems checkbox behaviour also randomly changed, i don’t think I had this problem with older versions but will also double check.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Toggle Angular checkbox with string values instead of ...
The checkbox toggles values as "optin" or "optout" when checked/unchecked and is initialized as "optin" by default in .ts file.
Read more >Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where urls within SASS/SCSS files were not being correctly resolved which could result in incomplete styling....
Read more >Fix list for IBM WebSphere Application Server V8.5
IBM WebSphere Application Server provides periodic fixes for the base and Network Deployment editions of release V8.5. The following is a complete listing ......
Read more >React Hooks Checkbox Not Setting Checked To True And False
Ask questions[v6.0.6] Bug: Checkboxes are always being cast to strings despite providing boolean default value. Describe the bug I'm trying to use.
Read more >Solved: Problem with checkbox.value = boolean
Now the problem, when I verify if checkbox.value = false its returns ... What I'm doing is converting value to string to solve...
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 Free
Top 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
@bluebill1049 I think some improvements to the docs with more checkbox examples and a search feature would help. I’ll take a look at how the docs are setup and see if I can contribute something here.
updated both the doc and CSB to emphasize checkbox example.