Home > @uniformdev/mesh-sdk-react > createLocationValidator
createLocationValidator() function
Creates a validation interceptor between useMeshLocation's setValue function and your code. You can use this utility to write cleaner validation logic for your Mesh Location UIs.
Signature:
Parameters
Parameter | Type | Description |
---|---|---|
setValue | SetLocationValueDispatch<TSetValue> | The location's raw setValue function |
validate | (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions | A function to validate the new location's value. |
Returns:
SetLocationValueDispatch<TSetValue>
An equivalent to the setValue function that intercepts sets, performs validation, and emits the result with the new value.