React Hooks Lightning Talk | Helpfulz

React Hooks Lightning Talk

July 13, 2019

So I had the opportunity to teach React Hooks to my class a week or two ago and it was a really cool experience for me. I am really passionate about Hooks and also it was a neat experience to be able to share it with the class and to practice teaching and all that stuff. it was good, however as always I had some thoughts come up and I want to prepare to be able to do it again and do it a bit better this time.

So here are the points that I pointed out and some of the things that I want to improve.

My first time starting at the React Hooks Docs, I skipped the part that talks about they “why” and just went right into how. Because of this I found it hard to be interested in it at first and quickly lost interest and just kinda changed directions.

A few weeks later I went back and looked into it a bit further. After reading the “why” behind it, it all made a lot more sense and I felt like this is starting to make sense why it has become such a big hit in the React community.

So some of the biggest advantages of using React Hooks is that your able organize your code by subjects and not based on lifecycle methods or parent/children components so much. It’s much easier to keep related things together using Hooks becuase you’re not constrained to the few lifecycle methods.

Not only that, but you can ditch the Class’s because you don’t really need them anymore, just go ahead and start with a React function and just throw state into it.

You can start extracting common functionality with custom Hooks, this is really cool because you can limit the code that you have in your components by just extracting the functionality that you use over and over.

I’ll be honest I’m still a bit new with React Hooks and I don’t know in depth all the different reasons why you might like them, but I’m “Hooked” and it’s always how I start writing React Components from now on.

Now, when I had the chance to share all of this, it all turned out to be a bit of a mouth vomit and the examples that I used to share with the class was a bit lackluster. Basically this is because I was told like 30 minutes before that I’d be doing it, I had no time to prepare anything specific so I just pulled up something I was working on.

I would really like to be able to show a before and after component where I had something using Classes and lifecycle methods, and then show how it can be cleaned up using react hooks. That is the ideal way to teach in my mind.

Also maybe a bit more live coding examples too. I know it can be difficult to live code, but at the same time that’s also a sign of a brave coder in my book 🙂

 

Anyways, that’s what was on my mind after being thrown into that experience. Was a good experience and I learned from ti and I want to be able to handle it a bit better next time.

 


Profile picture

Written by IzzleNizzle who can be found playing around in the mountains of Utah. ⛰️ You should follow Iz on Twitter

© 2022, Built with Gatsby and WordPress