Skip to content

Commit 4043688

Browse files
author
Dustyn Blackmore
committed
Further Project Housekeeping
Updated README.md Further clarity / elaboration on Validation.
1 parent cb5e9c2 commit 4043688

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,28 @@ export default App;
145145
For those interested in why this is included, please also see:
146146
[Notes On Validation](#validation-notes)
147147

148-
Validation is a, or an array of, objects which contain a 'callback', and
149-
validation error message. This object is provided to the component via the
150-
'validation' prop.
148+
* How-To / Overview:
151149

152-
The callback functions are passed the value of the triggered input, as
150+
Validation is an, or an array of, object(s). These objects contain two
151+
properties; callback, and errorMessage. This object is provided to the component
152+
via the 'validation' prop.
153+
154+
* How It Works:
155+
156+
Validation is handled during the React onChange event, not to be confused with
157+
the 'onChangeCallback' prop (Which is also called during the React onChange
158+
event).
159+
160+
The callback function is called with the value of the associated input, as
153161
provided by the [React Event](https://reactjs.org/docs/handling-events.html).
154-
The return of the function, (boolean) false or true, is used to determine the state of the
155-
component. If false; the validation error is rendered. If an array of validation
156-
is provided, and one fails - the component fails validation, however; only the
157-
failing validation object error message is shown.
162+
The return result of this function, boolean, then reflects the validity of the
163+
input.
164+
165+
Additionally; If an array of validation is provided, and only one of many fail;
166+
the component entirely fails validation. Finally, in this case; only the failing
167+
validation error message is rendered.
168+
169+
* Example:
158170

159171
An example validation object may be;
160172

0 commit comments

Comments
 (0)