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
fix(FormGroup): dont pass switch prop to tag #2415 #2416
fix(FormGroup): dont pass switch prop to tag #2415 #2416
Conversation
@@ -30,16 +30,17 @@ const FormGroup = (props) => { | |||
inline, | |||
floating, | |||
tag: Tag, | |||
switch: switchProp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave this as switch
instead of switchProp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not - doing so means you end up with ambiguity between the switch
variable and JavaScript switch
/case
statement - I can call it something else if you'd prefer, e.g. _switch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, It would be nice to see this ugly error message fixed.
Maybe a comment to explain the variable name would be good to approve this merge?
The other way is to keep the props.switch notation?
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't leave it as props.switch
- destructuring the prop like this fixes the issue - without it switch
remains in the attributes
object that is passed through to the underlying control.
As I say, I'm very happy to use whatever name is deemed appropriate, but as far as I know this PR hasn't even been looked at by any of the maintainers, so I don't think that's what's causing it to be left unmerged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workaround: you can remove the switch prop from FormGroup and replace with the bootstrap classname:
<FormGroup className="form-check form-switch">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had forgotten to respond, the PR looks good 👍
Fixes #2415 - I also noticed that the typings didn't include the
switch
prop, so I've added it for completeness.