Skip navigation
💡React tip: Use a custom hook to handle array states in your components
0:00 / 0:24

💡React tip: Use a custom hook to handle array states in your components

George Moller

@_georgemoller118K followers

Visit on X
1,228 likesDownloadOriginal post

119,743 views

💡React tip: Use a custom hook to handle array states in your components

11 Comments

Comments from the original post on X (Twitter)

  • George Moller's profile picture

    @_georgemoller

    I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics just like this one. Check them out ↓

    15 likes

  • George Moller's profile picture

    @_georgemoller

    I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics just like this one. Check them out ↓

    2 likes

  • Matej Bendík's profile picture

    @BendikMatej

    Splitting logic into more reusable components / hooks is why we use React. Great explanation, George 👊

    3 likes

  • George Moller's profile picture

    @_georgemoller

    I love how easy it is to reuse/encapsulate logic in React.

    2 likes

  • Shripal Soni's profile picture

    @codewithshripal

    Cool tip. I have never done this before ✨

    3 likes

  • George Moller's profile picture

    @_georgemoller

    It's quite useful to abstract those array helper methods in that way, try it out Shripal! :)

    2 likes

  • mlazos.eth's profile picture

    @mlazos7

    what is the idea of always returning an array of 2 elements in a hook instead of return an object {todos, add, remove} ?

    2 likes

  • Jennifer Tieu's profile picture

    @jennifer_tieu

    I always appreciate your tips George🥺 and currently enjoying Design for Developers too, keep it up 🫡❤️

    2 likes

  • George Moller's profile picture

    @_georgemoller

    Thanks Jennifer! I'm really glad you enjoy the tweets, make me wanna continue pushing content ☺️ Also happy that you like Design for Developers 🙏 If you ever have questions or need help with anything please don't hesitate to reach out :)

    1 like

  • Edgar Rodríguez's profile picture

    @codingedgar

    Can’t believe I’ve consumed this pattern so many times and I never authored 🤯 Thank you for making it so obvious 😩🤌

    2 likes

  • George Moller's profile picture

    @_georgemoller

    Hey Edgar! just saw that you are building in public 💪 following your journey now :)

    1 like