MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / resolver

Function resolver

app/src/customSchemaValidation.tsx:23–42  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

21});
22
23const resolver = async (data: unknown) => {
24 const { error, value: values } = validationSchema.validate(data, {
25 abortEarly: false,
26 });
27
28 return {
29 values: error ? {} : values,
30 errors: error
31 ? error.details.reduce((previous, { message, type, path }) => {
32 return {
33 ...previous,
34 [path[0]]: {
35 message,
36 type,
37 },
38 };
39 }, {})
40 : {},
41 };
42};
43
44const BasicSchemaValidation: React.FC = () => {
45 const { mode } = useParams();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected