DEV Community

Discussion on: Is there a way to explain hooks without mentioning class component?

Collapse
 
httpjunkie profile image
Eric Bishard

Yes, as well I don't think you want to start with useState in this scenario. Instead, you should teach about regular JS functions and how something very simple can be turned into a Hook. I have created an article about custom Hooks, and aside from using the word class a few times in the article I could remove that information about hwo things "use to be done". But yeah I think teaching how to create simple and custom hooks is a great way to teach about the subject without talking about classes.

I also think that when teaching about useState that it's good to tell the backstroy about classes and how this.state was accessed and used in a simple scenario and then explaining how that works with Hooks. This could be a second part to learning Hooks after you teach custome Hooks first.