From 7801daab054b89ddae91bbc3b9924a1d4fa365ff Mon Sep 17 00:00:00 2001 From: StephDietz Date: Wed, 25 Oct 2023 10:17:22 -0700 Subject: [PATCH] add react-dom/experimental to out types in tsconfig in order to work around the useFormState ts error --- dashboard/15-final/app/ui/invoices/create-form.tsx | 2 +- dashboard/15-final/tsconfig.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dashboard/15-final/app/ui/invoices/create-form.tsx b/dashboard/15-final/app/ui/invoices/create-form.tsx index 2c234d3..c28f93b 100644 --- a/dashboard/15-final/app/ui/invoices/create-form.tsx +++ b/dashboard/15-final/app/ui/invoices/create-form.tsx @@ -11,7 +11,7 @@ import { import { Button } from '../button'; import { createInvoice } from '@/app/lib/actions'; // @ts-ignore React types do not yet include useFormState -import { experimental_useFormState as useFormState } from 'react-dom'; +import { useFormState } from 'react-dom'; export default function Form({ customers }: { customers: CustomerField[] }) { const initialState = { message: null, errors: [] }; diff --git a/dashboard/15-final/tsconfig.json b/dashboard/15-final/tsconfig.json index 8c283d1..11dba1d 100644 --- a/dashboard/15-final/tsconfig.json +++ b/dashboard/15-final/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "types": ["react-dom/experimental"], "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true,