I need to get some form data submitted from a NextJS page to another (server side rendered) page in it getServerSideProps function. basically the api that i need call in the getServerSideProps() needs those data to be passed. thought of using localStorage/sessionStorage to store data on the form page and retreive in the function but this wont work as it renders on server. Any Help ?
Asked
Active
Viewed 884 times
1 Answers
0
You can forward the form data fields as query params, or create an object with the form fields and then base64 encode the object, add that string in the query params.
In the next page you can access the params from query
in context parameter of the getServerSideProps
and then decode the base64 data to retrieve the form fields

Kaushik
- 921
- 10
- 18
-
Yeah this works, however, i need to pass it through http incoming request so that it does not appears on URL. Any help? – Vivek Tiwari Apr 09 '21 at 08:14
-
Can elaborate what you are trying to do may be with some code snippet ? You requirement is still unclear to me – Kaushik Apr 09 '21 at 09:38