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

FormGroup: Using switch prop results in warning: Received true for a non-boolean attribute switch #2415

Closed
mikegoatly opened this issue Dec 10, 2021 · 2 comments · Fixed by #2416

Comments

@mikegoatly
Copy link
Contributor

  • components: name
  • reactstrap version #9.0.1
  • import method typescript, import { FormGroup } from 'reactstrap' - whichever that is :)
  • react version #17.0.2
  • bootstrap version #5.1.3

What is happening?

When using the switch prop with FormGroup:

<FormGroup switch>
...
</FormGroup>

I get this warning in the browser:

Warning: Received `true` for a non-boolean attribute `switch`.
      
      If you want to write it to the DOM, pass a string instead: switch="true" or switch={value.toString()}.
          at div
          at FormGroup (C:\dev\Portal\src\Coeo.Portal\clientapp\node_modules\reactstrap\src\FormGroup.js:25:5)
         ...

What should be happening?

No warnings should be displayed.

Steps to reproduce issue

  1. Create a FormGroup and set the switch prop.
  2. Run the app

Error message in console

See above.

Code

https://reactstrap-py5tda.stackblitz.io

(Check the console pane to see the warning)

@mikegoatly
Copy link
Contributor Author

For visibility here, @jfhenon mentioned this workaround in the pull request:

workaround: you can remove the switch prop from FormGroup and replace with the bootstrap classname:
<FormGroup className="form-check form-switch">

davidacevedo added a commit that referenced this issue Apr 13, 2022
fix(FormGroup): dont pass switch prop to tag #2415
@davidacevedo
Copy link
Collaborator

Fix should be a part of 9.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants