@cosdensolutions: How to properly reset forms in React #react #reactjs #reactjsdeveloper #programming #progammer #frontend #devtok #coding #code #codetok

Cosden Solutions
Cosden Solutions
Open In TikTok:
Region: RO
Tuesday 16 May 2023 12:44:23 GMT
52001
2588
67
64

Music

Download

Comments

pastean
Calin Pastean :
great way to send another developer into a one hour debugging session
2023-05-16 18:20:22
40
bluhhuhuhuh
Tyson :
That's not what keys are for. And suggesting a jr dev make use of this wonky hack instead of coding their own logic is disingenuous
2023-05-16 17:22:46
30
simonecervini
Simone Cervini :
A lot of experts in the comments should read “You Might Not Need an Effect” from the official react docs. THIS is actually the suggested method
2023-05-17 10:15:39
4
freyj1031
freyj1031 :
Why not just make a reducer and make a reset action?
2023-05-16 19:11:13
2
lexelg
KT :
if you use a framework, most of the time Form components have a functional API to reset fields as well. READ DOCUMENTATION!
2023-05-25 12:53:59
2
axel7083
Me :
this is not good approach because it make tje component hard not automous, and require the parent to know the internal logic of the child, bad.
2023-05-19 16:38:09
2
night_fury248
Night_Fury :
nice. great way to make use of key prop.
2023-05-16 16:20:00
2
tjhooper3
Tj :
An even better approach is to use libraries like react router or react query to handle form/state updates based on query param values like id
2023-05-17 21:55:21
2
nero00xx
Tone | Software Engineer :
There’s a better way to implement resetting the form via redux
2023-05-16 22:06:29
2
kabbekab
Kabbe :
I dont understand. This is based on "for getting" to set a local state. Thats not a bug imo.
2023-05-16 23:22:58
1
user30594885974435
user30594885974435 :
Why some one will do this? After submitting the form and success from server just reset
2023-05-16 20:25:59
1
user30594885974435
user30594885974435 :
Dude in the first comment I didn’t understand how will use useEffect like that, but now hooo you are showing something is bad in so many ways, I don’t
2023-05-16 20:31:01
1
user30594885974435
user30594885974435 :
To be the bad dude, I’m just going to say you are a unique programmer I’ll never what to work with someone do things like this, you cause react to
2023-05-16 20:32:53
1
alexcondurachi1
Alex Condurachi :
But the profile form should make an Ajax call for profile info tho, display the data and provide edit funcl, taking user id as pr makes no sense realy
2023-05-16 19:11:01
1
bemax123
BeMax123🇽🇰🇦🇱 :
👍
2023-05-16 13:21:13
1
fvckyuooo8
jorge :
use react form
2023-05-17 01:55:35
1
reuel88
Reuel :
You learn something everyday
2023-05-17 07:32:03
1
isfares
F. :
or just add setFirstName("") at the end of submit function
2023-05-17 08:49:02
1
ionutsandu40
Ionut Sandu :
This feels like a hack. I would still do it the right way to make sure the person that's reading the code understands it.
2023-05-17 08:54:35
1
javitheowl
JaviTheOwl :
Theme? 👀
2023-05-16 16:29:46
1
fernando_her85
Fernando :
Is this even needed in the first place? if you correctly summited the form, you redirect the user to another page and that will destroy the component.
2023-05-17 11:47:13
1
panda_og1
Andy :
How to pass value from child component to parent
2023-05-17 15:03:07
1
locpham32197
Col Store :
New key->new compnent. Got it🥰🥰
2023-05-16 16:23:58
1
hydrogennuclei
Random Atom :
Doing this for 5 years ( before useEffect) people complaining about this? Hmm
2023-05-17 23:53:58
1
thanhtutzawdev
Than Htut Zaw :
I can see clearly with example but I still can't use in my real project
2023-05-18 04:15:38
1
To see more videos from user @cosdensolutions, please go to the Tikwm homepage.

Other Videos


About