question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a Checkbox or Modal emits an error in the console when using Preact

See original GitHub issue

Steps

  1. Using the preact-cli, build a basic project.
  2. npm install --save semantic-ui-react
  3. Add a simple form with a checkbox element anywhere in the project. Sample code:
<Form>
    <Form.Checkbox label='Why the errors?'/>
</Form>
  1. The following errors show up in the console log.
    1. Checkbox is missing "defaultChecked" propTypes validation for auto controlled prop "checked".
    2. Checkbox is missing propTypes validation for auto controlled prop "checked".
    3. Checkbox is missing "defaultIndeterminate" propTypes validation for auto controlled prop "indeterminate".
    4. 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:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rbscottcommented, Jul 25, 2017

@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.

0reactions
brianjdcommented, Jul 27, 2017

@rbscott preact-compat is the solution you are looking for.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found