Why I can't use experimental_useFormState
Answered
Cairn Terrier posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
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
![Image](https://cdn.discordapp.com/attachments/1156607091977502750/1156607092749238354/image.png?ex=651595cb&is=6514444b&hm=1896b43c3cc2af3015f28a961caeb6154bfb4cd798f45097ee4131946eca63a4&)
14 Replies
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
thats because it isn't in the typescript types
it should work otherwise
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Cairn TerrierOP
so, what should i do?
sorry i am still newbie in typescript btw ðŸ˜
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
wait for this: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66726 ig
umm you could try adding
// @ts-expect-error
on top of the error line and not have the types for some time![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Cairn TerrierOP
so, i just need to initialize the type of the useFormState isn't it?
it doesn't work
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
like show the code you did as i thought you can make it quiet from doing that
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Cairn TerrierOP
like this?
![Image](https://cdn.discordapp.com/attachments/1156607091977502750/1156608613729710121/code.png?ex=65159736&is=651445b6&hm=c53d8f26151ca351161468af6487c621e576695458a247b68954753037e30c8b&)
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
like do something like this
![Image](https://cdn.discordapp.com/attachments/1156607091977502750/1156608828394188931/image.png?ex=65159769&is=651445e9&hm=bed1ef6566e7954225b431e54544664738c26b41ccbf5122d42b0a03937ddee7&)
Answer
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
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?![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Cairn TerrierOP
the error was gone, but i have another problem, so i decided for change to old code, without using the experimental feature