DEV Community

Brayden W ⚡️
Brayden W ⚡️

Posted on • Updated on

I learned React Hooks and now I'm the happiest dev on the planet! 🌎

A couple days ago I posted about a simple CRM tool I made after learning React basics in 24 hours.

I got lot's of useful feedback. Mike Cavaliere told me about this thing called React Hooks. At the time, I was somewhat familiar with the term but didn't know what was so great about it.

Anywho, this morning I took the time to learn the basics of useEffect and useState and I am literally the happiest developer on the planet. 😎

Happy picture

Why am I so happy? 😁

It's simple.

The workflow to create components is much smooth and neat. Also much easier than using class components instead.

I'm thinking of improving my current set of skills and then will start to learn Redux and Styled Components.


I would love if any of you have feedback on what I should fix/learn next. The Github repository is below if you want to take a peak at the code. 😉

👉 https://github.com/BraydenTW/simple-react-crm


This was originally posted on IndieHackers

Top comments (5)

Collapse
 
isaachatilima profile image
Isaac Hatilima

Hi Brayden, is there a way of having less code in your AddCustomer.is? Where you have
const onNameChange = e => {
setName(e.target.value)
}
Does that mean you will have to repeat that code structure for however many input fields you have?

Collapse
 
hnrq profile image
Henrique Ramos

How's it going, Isaac? I think you can make a custom hook for input fields. This is mentioned in some articles and Dan Abramov also creates one of those on "React Today and Tomorrow and 90% Cleaner React With Hooks".

Collapse
 
braydentw profile image
Brayden W ⚡️

No, this function is only for changes to inputs with for the name. I only have one.

Then there is another function for the tag radio buttons.

Collapse
 
hnrq profile image
Henrique Ramos

A good tip is to avoid changing a HTML Element state by using document.getElementById. You should always aim to make controlled components. Other than that, keep up the good work! (Also, I really feel you, man, Hooks changed my life)

Collapse
 
braydentw profile image
Brayden W ⚡️

Good tip! I’ll work on that. Thanks for your help :D