After form submit, use the data from the method that was submitted to
See original GitHub issueAt the moment, it appears as though the new page’s props always come from GET
. If so, this doesn’t allow returning and using an error message from a json() in POST
or PATCH
. Next.js’s data fetching mechanism is kind of blurry to me, so I’m not sure how this should be accomplished 🤔 I might also not be observing this correctly, but I can try to reproduce it later
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Sending form data - Learn web development | MDN
The GET method is the method used by the browser to ask the server to send back a given resource: "Hey server, I...
Read more >what happens after a form is submitted? - Stack Overflow
When you click the submit button, your form data will be sent to the file specified on the form tag - in your...
Read more >What happens after submit is pressed? Where does the ...
I understand the forms and different types of input but i'm assuming the page after you press the submit button is another landing...
Read more >HTML form method Attribute - W3Schools
The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute). The form-data can...
Read more >Forms: event and method submit
There are two main ways to submit a form: ... Both actions lead to submit event on the form. The handler can check...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If we can’t figure out how to rerender the current page component with custom data, we might be able to work around it by introducing a
useRouteData
hook, like remix does. But maybe call ituseFormResponse
to make the association withForm
clearer.We’ve released https://github.com/smeijer/next-runtime/releases/tag/v2.0.0. Response data is now part of the return value of
useFormSubmit
, and we offerwithNextRuntime
for those that really need to update the page props after form submit.