Illustration of a microphone

Calls with Kent C. Dodds.

You call, I'll answer.

Listen to the podcasts here
Phone sitting on a stool

What's this all about?

The goal of the Call Kent Podcast is to get my answers to your questions. You record your brief question (120 seconds or less) right from your browser. Then I listen to it later and give my response, and through the magic of technology (ffmpeg), our question and answer are stitched together and published to the podcast feed.

I look forward to hearing from you!

Record your call

Calls with Kent C. Dodds Season 2 — 50 episodes

01.Best way to reset a form
05:27
Keywords

react, forms, performance

Description
In the example, submitting the form successfully will still retain the current values of the fields.
I want the behavior such that"
  1. when the server response says the form is NOT submitted successfully, then the form field will have the current values that has been inputted by the user
  2. But when the server response says that the form is successfully submitted, then the form fields will be blank again.
What's do you think is the best and most performant (and readable) code to approach this in pure React? The approach which will reduce the amount of unnecessary rerenders of the fields?
Thank you!
01.Best way to reset a form
05:27
Keywords

react, forms, performance

Description
In the example, submitting the form successfully will still retain the current values of the fields.
I want the behavior such that"
  1. when the server response says the form is NOT submitted successfully, then the form field will have the current values that has been inputted by the user
  2. But when the server response says that the form is successfully submitted, then the form fields will be blank again.
What's do you think is the best and most performant (and readable) code to approach this in pure React? The approach which will reduce the amount of unnecessary rerenders of the fields?
Thank you!
01.Best way to reset a form
05:27
Keywords

react, forms, performance

Description
In the example, submitting the form successfully will still retain the current values of the fields.
I want the behavior such that"
  1. when the server response says the form is NOT submitted successfully, then the form field will have the current values that has been inputted by the user
  2. But when the server response says that the form is successfully submitted, then the form fields will be blank again.
What's do you think is the best and most performant (and readable) code to approach this in pure React? The approach which will reduce the amount of unnecessary rerenders of the fields?
Thank you!
01.Best way to reset a form
05:27
Keywords

react, forms, performance

Description
In the example, submitting the form successfully will still retain the current values of the fields.
I want the behavior such that"
  1. when the server response says the form is NOT submitted successfully, then the form field will have the current values that has been inputted by the user
  2. But when the server response says that the form is successfully submitted, then the form fields will be blank again.
What's do you think is the best and most performant (and readable) code to approach this in pure React? The approach which will reduce the amount of unnecessary rerenders of the fields?
Thank you!

Looking for more content?

Have a look at these articles.

See the full blog