You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onChange was renamed to onInputChange in Form.js. We should update this and rename it in all usages of CheckboxWithLabel.
The usage in Form.stories.js is incorrect. We should NOT pass onPress or isChecked to CheckboxWithLabel since Form provides the "onChange" handler automatically. We also use it as an uncontrolled input in Form and passing isChecked means that we would have to control the component state in Form. We should instead move this logic to CheckboxWithLabel, so that the interface looks as that of an uncontrolled input.
Calling React.forwardRef inline means that some props passed automatically from Form might not be defined when React runs its prop validation. We should call it in export default spreading all the props passed to the component, similar to what we do in AddressSearch
Why is this important?
We need to have the correct interface to work with Form.js
Solution
Described in each point above.
The text was updated successfully, but these errors were encountered:
Problem
I noticed a few things that should have been different with the CheckboxWithLabel refactor:
onChange
was renamed toonInputChange
in Form.js. We should update this and rename it in all usages ofCheckboxWithLabel
.onPress
orisChecked
toCheckboxWithLabel
sinceForm
provides the "onChange" handler automatically. We also use it as an uncontrolled input in Form and passingisChecked
means that we would have to control the component state in Form. We should instead move this logic toCheckboxWithLabel
, so that the interface looks as that of an uncontrolled input.export default
spreading all the props passed to the component, similar to what we do in AddressSearchWhy is this important?
We need to have the correct interface to work with
Form.js
Solution
Described in each point above.
The text was updated successfully, but these errors were encountered: