Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox: Warning: specify either the checked prop, or the defaultChecked prop, but not both #6197

Closed
arnodemer opened this issue Mar 21, 2024 · 1 comment · Fixed by #6200
Assignees
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@arnodemer
Copy link
Contributor

Describe the bug

Checkbox uses both checked and defaultChecked properties on underlying checkbox input.
This raise warning on console (or when running jest tests):

Reproducer

No response

PrimeReact version

10.5.3

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

Warning: Checkbox contains an input of type checkbox with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components
at input
at div
at D:\onetest-server\frontend\node_modules\primereact\checkbox\checkbox.cjs.js:141:26
at div

Expected behavior

No response

@arnodemer arnodemer added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 21, 2024
@kyybo
Copy link
Contributor

kyybo commented Mar 21, 2024

This warning problem is already mention in this issue : #6181 😄

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 21, 2024
@melloware melloware self-assigned this Mar 21, 2024
@melloware melloware added this to the 10.6.0 milestone Mar 21, 2024
melloware added a commit to melloware/primereact that referenced this issue Mar 21, 2024
melloware added a commit to melloware/primereact that referenced this issue Mar 21, 2024
melloware added a commit to melloware/primereact that referenced this issue Mar 21, 2024
@melloware melloware reopened this Mar 21, 2024
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 21, 2024
nitrogenous added a commit that referenced this issue Mar 21, 2024
Fix #6197: Checkbox remove defaultChecked property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants