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
See #1348 and #833 for context. We will remove the special behavior of the onSubmit prop in favor of the vanilla React onSubmit behavior. This includes the serializer than passes the form data to the onSubmit callback.
More info:
We currently provide an onSubmit handler for the Form. This handler includes a Form data serializer. There are two issues with this:
The serializer is DOM based and was planned to be migrated to migrated to a React callback mechanism, but this never happened. Interacting with the DOM is an antipattern in a React app.
The callback and its serializer have encouraged improper usage of Forms and events. Users are encouraged to try to reach down the tree to invoke the onSubmit event so that they can retrieve the data out of their Form. This is also an antipattern in React. Data should be hoisted up the tree using controlled Form control components. Then, when the form data is needed, it is readily available in some higher state.
In the long term, we may still provide a component that makes working with Forms easier. However, this would be more akin to the DataTable #1133 which wraps a simple stateless Table and makes working with data state easier. We would likely provide some kind of wrapper that could manage the parent-child relationship of the Form and its controls and provide simple top level callbacks for capturing data. This might be similar to the AdvancedForm #527 experiment.
The text was updated successfully, but these errors were encountered:
See #1348 and #833 for context. We will remove the special behavior of the
onSubmit
prop in favor of the vanilla ReactonSubmit
behavior. This includes the serializer than passes the form data to theonSubmit
callback.More info:
We currently provide an
onSubmit
handler for the Form. This handler includes a Form data serializer. There are two issues with this:The serializer is DOM based and was planned to be migrated to migrated to a React callback mechanism, but this never happened. Interacting with the DOM is an antipattern in a React app.
The callback and its serializer have encouraged improper usage of Forms and events. Users are encouraged to try to reach down the tree to invoke the
onSubmit
event so that they can retrieve the data out of their Form. This is also an antipattern in React. Data should be hoisted up the tree using controlled Form control components. Then, when the form data is needed, it is readily available in some higher state.In the long term, we may still provide a component that makes working with Forms easier. However, this would be more akin to the DataTable #1133 which wraps a simple stateless Table and makes working with data state easier. We would likely provide some kind of wrapper that could manage the parent-child relationship of the Form and its controls and provide simple top level callbacks for capturing data. This might be similar to the AdvancedForm #527 experiment.
The text was updated successfully, but these errors were encountered: