Why I can't use experimental_useFormState
Answered
Cairn Terrier posted this in #help-forum

Cairn TerrierOP
hii everyone, I recently watch the nextJS tutorial video for formHandler using useFormState, but when i try it on my code, it doesn't work, am i do it wrong? need some help, thanks

14 Replies

thats because it isn't in the typescript types
it should work otherwise

Cairn TerrierOP
so, what should i do?
sorry i am still newbie in typescript btw ðŸ˜

wait for this: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66726 ig

@Cairn Terrier so, what should i do?

umm you could try adding
// @ts-expect-error
on top of the error line and not have the types for some time
Cairn TerrierOP
so, i just need to initialize the type of the useFormState isn't it?

@risky umm you could try adding `// @ts-expect-error` on top of the error line and not have the types for some time

Cairn TerrierOP
it doesn't work

like show the code you did as i thought you can make it quiet from doing that

Cairn TerrierOP
like this?


Answer

the expect error will warn you when it has types next
@Cairn Terrier did it work? and can you try using
experimental_useFormState
and see if that works as intended?
Cairn TerrierOP
the error was gone, but i have another problem, so i decided for change to old code, without using the experimental feature