React Compiler: maximize compatibility with react-hook-form

This commit is contained in:
gbuomprisco
2024-10-28 10:44:40 +08:00
parent 8e9d6659e1
commit 64e7e30b3d
3 changed files with 19 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ import { useMemo } from 'react';
import { zodResolver } from '@hookform/resolvers/zod';
import { ArrowRight, CheckCircle } from 'lucide-react';
import { useForm } from 'react-hook-form';
import { useForm, useWatch } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { z } from 'zod';
@@ -87,7 +87,10 @@ export function PlanPicker(
},
});
const { interval: selectedInterval } = form.watch();
const selectedInterval = useWatch({
name: 'interval',
control: form.control,
});
const planId = form.getValues('planId');
const { plan: selectedPlan, product: selectedProduct } = useMemo(() => {