From 317b750508c2cf4d158c09a1d4e89adcba40f5a8 Mon Sep 17 00:00:00 2001 From: ethangardner Date: Wed, 23 Oct 2024 11:27:47 -0400 Subject: [PATCH] re-add useform hook. needed for pattern validation --- packages/design/src/Form/components/Repeater/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/design/src/Form/components/Repeater/index.tsx b/packages/design/src/Form/components/Repeater/index.tsx index 86e42385..b02f14a3 100644 --- a/packages/design/src/Form/components/Repeater/index.tsx +++ b/packages/design/src/Form/components/Repeater/index.tsx @@ -1,10 +1,13 @@ import React from 'react'; -import { useFieldArray } from 'react-hook-form'; +import { useFieldArray, useForm } from 'react-hook-form'; import { type RepeaterProps } from '@atj/forms'; import { type PatternComponent } from '../../index.js'; const Repeater: PatternComponent = props => { + const { control } = useForm(); + const { fields, append, remove } = useFieldArray({ + control, name: 'fields', });