question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After form submit, use the data from the method that was submitted to

See original GitHub issue

At 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:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
smeijercommented, Sep 19, 2021

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 it useFormResponse to make the association with Form clearer.

1reaction
smeijercommented, Sep 22, 2021

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 offer withNextRuntime for those that really need to update the page props after form submit.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found