Ohans Emmanuel
Aug 15, 2022 ⋅ 15 min read

How to refactor React components to use Hooks

Ohans Emmanuel Visit me at ohansemmanuel.com to learn more about what I do!

Recent posts:

Mastering Modulo Operator JavaScript

Mastering the modulo operator in JavaScript: A complete guide

We investigate how the modulo operator works in JavaScript and explore several real-life applications, like cyclic patterns and animations.

Timonwa Akintokun
Dec 8, 2023 ⋅ 7 min read
Ken Pickering Leader Spotlight

Leader Spotlight: Building with grit with Ken Pickering

Ken Pickering discusses the challenges associated with uncertainty and shares insights on scaling data structures and engineering teams.

Jessica Srinivas
Dec 8, 2023 ⋅ 7 min read
Understanding Solid Js Props A Complete Guide From Beginner To Advanced

Understanding SolidJS props: A complete guide

Let’s see how Solid props work to promote component reusability, exploring basic to advanced concepts for a complete understanding.

Temitope Oyedele
Dec 7, 2023 ⋅ 11 min read
Eleventy Vs. Next.js Static-Site Generation

Eleventy vs. Next.js for static site generation

We evaluate Eleventy and Next.js and compare both static site generators in terms of performance, developer experience, scalability, and ecosystem.

Nelson Michael
Dec 7, 2023 ⋅ 11 min read
View all posts

4 Replies to "How to refactor React components to use Hooks"

  1. This is the best article that explains well the different react hooks for me. Thanks a lot for this! Btw, do you recommend to omit react-redux over react hooks? Sorry about my grammar.

  2. Hello, thank you for this thorough article. I do have a question about the second example involving the class component with proptypes. I was wondering how/why the refactored code resulted in this:

    App.propTypes = {
    name: PropTypes.number

    Particularly, it is the “PropTypes.number” part of it I don’t understand. Because it first appears as:

    static propTypes = {
    name: PropTypes.string

    Any clarification would be greatly appreciated. Thank you.

Leave a Reply