DEV Community

Discussion on: I was creating Forms the wrong way all along in React.js πŸ€”

Collapse
 
joelbonetr profile image
JoelBonetR πŸ₯‡

That's it!
It was really hard on my last projects to make junior devs to understand that, because if you only learnt react that's what you'll find in the doc about managed/controlled forms so React is the only "source of truth".

That's useful on multi-step forms but I still can't find a way in which this is better than using the DOM itself through HTML.

Moreover you can set validations as well in the HTML using the pattern attribute and use :valid and :invalid CSS selectors to style them depending on the state they're in (I thought I made a post on that stuff but I just realized I didn't so maybe I should cover all that stuff in a single place πŸ˜‚).

Collapse
 
anubha143 profile image
Anubha Pant

Please do write a post and share all the knowledge you have.

Collapse
 
joelbonetr profile image
JoelBonetR πŸ₯‡
Collapse
 
joelbonetr profile image
JoelBonetR πŸ₯‡

I do it from time to time, check my profile!
Also follow to receive new posts in your feed 😁

Collapse
 
starkraving profile image
Mike Ritchie

Thanks for bringing this up! Just because you’re using JavaScript to render the elements doesn’t mean you shouldn’t also render markup that does its own work too… use the tools for what they’re made for!

Collapse
 
kuvambhardwaj profile image
Kuvam Bhardwaj

Yeah, that appears quite a large bite for a junior dev to gulp πŸ˜‚
Thanks for the comment btw ✨

Collapse
 
joelbonetr profile image
JoelBonetR πŸ₯‡

Yes but just because some years ago people learnt HTML to the detail, then CSS, then JS browser API and then frameworks/libs.

I'm finding lately a good amount of juniors that don't know what is the real scope of React... I've even told by one that map is a React method πŸ˜… so my guess is that the issue is the learning path itself...

Thread Thread
 
kuvambhardwaj profile image
Kuvam Bhardwaj

This is a legit issue, and new frameworks like svelte for example, make you learn more of "svelte" and not more of "javascript". Svelte is cool & I love it, but I think one should know fundamentals of Vanilla JS before dipping toes in libraries/frameworks

Thread Thread
 
joelbonetr profile image
JoelBonetR πŸ₯‡

Totally agree!