Creating a Checkbox or Modal emits an error in the console when using Preact
See original GitHub issueSteps
- Using the preact-cli, build a basic project.
npm install --save semantic-ui-react
- Add a simple form with a checkbox element anywhere in the project. Sample code:
<Form>
<Form.Checkbox label='Why the errors?'/>
</Form>
- The following errors show up in the console log.
Checkbox is missing "defaultChecked" propTypes validation for auto controlled prop "checked".
Checkbox is missing propTypes validation for auto controlled prop "checked".
Checkbox is missing "defaultIndeterminate" propTypes validation for auto controlled prop "indeterminate".
Checkbox is missing propTypes validation for auto controlled prop "indeterminate".
Expected Result
No errors are emitted.
Actual Result
4 errors are emitted.
Version
0.71.1
Testcase
Repository is pretty barebones, but had to make a separate project in order to demonstrate the issue. https://github.com/rbscott/auto-controlled-error
Notes
I am not sure if Preact is official supported, but it seems to mostly work. If someone points me in the right direction, I could put together a Pull Request.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Checkbox not working - Inertia with ReactJS - Laracasts
I have a form in a modal that creates a user with roles. When I try to check the roles and output the...
Read more >https://raw.githubusercontent.com/cjsheets/Semanti...
... Creating a Checkbox or Modal emits an error in the console when using Preact [\#1869](https://github.com/Semantic-Org/Semantic-UI-React/issues/1869) ...
Read more >Forms | Preact: Fast 3kb React alternative with the same ES6 ...
In our change event handler, we set a value in state to the new value received from the checkbox. Doing so will trigger...
Read more >@esri/calcite-components | Yarn - Package Manager
Changelog. This document maintains a list of released versions and changes introduced by them. This project adheres to Semantic Versioning ...
Read more >Recently Active 'testing-library' Questions - Page 3 - Stack Overflow
I'm using the @testing-library/preact-hooks lib for testing my custom hooks ... polished function throws error only in test suite, not in actual app/browser....
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
@levithomason thanks for the info. It looks like preact removes prop types for all builds. There is a PR to change this behavior so it only removes propTypes during production builds. I believe this will resolve this issue.
@rbscott preact-compat is the solution you are looking for.