Next.js Discord

Discord Forum

useActionState Testing

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Im really having difficult time testing any component that has useActionState hook its a greate hook but I really can't test it somehow.
the main problem is that I want to mock the action function that is being used so I can set whatever data I want, but it doesn't work at all

this is an example
const [formState, formAction] = useActionState(mainAction, SOME_STATE);

<form action={formAction}>


I want to mock that formAction, Im using jest btw

0 Replies