Open
Description
❓Question
I think there is a bug in useControlledSwitchWarning
that will rendering two different warnings at the same time.
- when the component goes from controlled to uncontrolled and,
- when the component goes from uncontrolled to controlled.
I believe the first warning condition is incorrect. I would be happy to throw up a PR with the following change:
warning(
!(isControlled && !wasControlled),
`\`${componentName}\` is changing from uncontrolled to be controlled. Reach UI components should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled \`${componentName}\` for the lifetime of the component. Check the \`${controlPropName}\` prop.`
);
Hope I'm not missing something blatantly obvious 😓
Metadata
Assignees
Labels
No labels