Relative Content

Tag Archive for javascriptnext.jsserver-side-renderingformikyup

How do you access form values on the server in nextJs?

I can’t properly pass form data to my api endpoint in nextJS. I am using formik and yup to create the form and validate the data. When I log the data to the console on the client, I see the user input in the console. But, I get undefined for those values on the server. Also, when I print the request object to the console, the body is empty, and bodyUsed is set to false.
Here is my client component:

How do you pass form values from a client component to an api route in nextjs and formik?

I can’t properly pass form data to my api endpoint in nextJS. I am using formik and yup to create the form and validate the data. When I log the data to the console on the client, I see the user input in the console. But, I get undefined for those values on the server. Also, when I print the request object to the console, the body is empty, and bodyUsed is set to false.
Here is my client component: