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

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

setValue

</td><td>

SetLocationValueDispatch<TSetValue>

</td><td>

The location's raw setValue function

</td></tr> <tr><td>

validate

</td><td>

(newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions

</td><td>

A function to validate the new location's value.

</td></tr> </tbody></table> Returns:

SetLocationValueDispatch<TSetValue>

An equivalent to the setValue function that intercepts sets, performs validation, and emits the result with the new value.