Argument properties
Introduction
Each callback function in React Advanced Form uses an "Object as argument" approach, meaning that it exposes an argument Object with the set of fixed properties. Take a look at the example:
Notice how the argument of action
handler (this.handleSubmit
) is passed like an Object:
This is the way how all arguments are passed to the custom callback functions. Argument properties like fields
and form
are always present in whichever callback method is being handled. On top of that, additional (or contextual) argument properties are passed to the argument Object as well.
Note: You may see argument Object properties including all the possible properties in the examples over here. That is done solely for demonstrational purposes, you do not need to include all argument properties – only the ones you need at the moment.
Benefits
Adopting this approach grants the following benefits:
Optional inclusion of arguments without unnecessary arguments listing:
Defined Object keys ensure the consistent namespaces throughout the whole implementation:
Easier dynamic composition:
Keynotes
Names of argument properties is the same throughout all callback method handlers. If it's
fields
it'sfields
everywhere.Names of argument properties is designed to be intuitive and clear. Please create a pull request if you find obscure variable names.
Last updated