<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thu Vo (Jamie) on Medium]]></title>
        <description><![CDATA[Stories by Thu Vo (Jamie) on Medium]]></description>
        <link>https://medium.com/@vctth?source=rss-64aef8c786------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*l7mINaol923dOIfh.</url>
            <title>Stories by Thu Vo (Jamie) on Medium</title>
            <link>https://medium.com/@vctth?source=rss-64aef8c786------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:38:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vctth/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Should You Consider Moving to React Hooks?]]></title>
            <link>https://medium.com/@vctth/why-should-you-consider-moving-to-react-hooks-84886c7fa79b?source=rss-64aef8c786------2</link>
            <guid isPermaLink="false">https://medium.com/p/84886c7fa79b</guid>
            <category><![CDATA[react-js-development]]></category>
            <category><![CDATA[tech-blog]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Thu Vo (Jamie)]]></dc:creator>
            <pubDate>Fri, 20 Mar 2020 02:26:02 GMT</pubDate>
            <atom:updated>2020-03-20T02:26:02.089Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why Should You Consider Moving to React Hook?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*bCg0khegzKfjhoLktDaeMw.png" /><figcaption>React Hooks</figcaption></figure><p>If you’ve been working with React for a long period of time, we would like to introduce to you React Hooks, which may also make your coding life easier</p><p>Developers rejoice! The <strong>React Hook</strong> concept — launched at React Conf 2018 — entails. <strong>React</strong> <strong>Hook</strong> patterns that enable us to use state, lifecycles, and (almost) any other React features without using classes.</p><p>To avoid duplicating code and handling many <strong>Components</strong>, we use <strong>Higher-Order Components (HOC) </strong>to create reusable logic for future cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tK1HIPF4m-Uokg4nFDfEg.png" /><figcaption><strong>Higher-Order Components</strong></figcaption></figure><p>Wrapping too many HOCs together can cause `<strong>Wrapper Hell</strong>`, and the code below might appear. That’s quite complex to read and understand, isn’t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*k0qwVkCN-_zjlPtmMLgFvA.png" /><figcaption>Wrapper Hell</figcaption></figure><p>In addition, you may often use<strong> Functional Components</strong> to reuse logic by passing data to props.children or cloning children with many props. However, <strong>Functional Components </strong>does not have a constructor, extending from React. That’s because React methods (lifecycles) can’t be applied. This is called <strong>Stateless Component</strong>, which means you can’t declare and manage state here. And there is a big problem when using <strong>Functional Components</strong>:</p><blockquote>You cannot manage the rendering of components.</blockquote><p><strong>Functional Components </strong>will render after any properties are changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*75ByWGjikZoUzgk31wCOTA.png" /><figcaption>Passing data to props.children and cloning children with many props.</figcaption></figure><p>But now with <strong>React Hooks,</strong> you no longer have to concern yourself with such a problem. This helps you extract, reuse logic, and kill this keyword. We use <strong>Components</strong> like <strong>Functional Components</strong> from <strong>Stateless</strong> to <strong>Stateful Components.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*hOyWzrNbb-KXSdnipFvxfQ.png" /><figcaption>React Hooks</figcaption></figure><p>Furthermore, <strong>React Hooks</strong> help you streamline the code and minify better.</p><h4>1. State</h4><ul><li>Class</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*XagSUFWID9BJnpymiMjJUA.png" /><figcaption>State in Class</figcaption></figure><ul><li>Hook</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*HGIPHmAK2YzhnDiSDkzhpA.png" /><figcaption>State in Hook</figcaption></figure><p>- Transition ability from <strong>Stateless</strong> to <strong>Stateful</strong></p><p>- Shortened code</p><p>- More professional-looking interface!</p><h4>2. Lifecycles</h4><blockquote><em>If you’re familiar with React class lifecycle methods, you can think of </em><em>useEffect Hook as </em><em>componentDidMount, </em><em>componentDidUpdate, and </em><em>componentWillUnmount combined.</em></blockquote><p>In React class components, the componentDidUpdate method calls after rendering finishes. However, componentDidUpdate does not call after the first rendering. Therefore, we need componentDidMount and write the same code here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*C1Ven1-moYXnF_fFmmSDdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*OFyzFovVeedw_tSrnQzivA.png" /><figcaption>Lifecycles of Hook and Class</figcaption></figure><p>Moreover, you can limit the number of calls after each rendering only by watching the state (EX: count) you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*UprzjM3fgWYvXrPPiKna1A.png" /><figcaption>React Hook with the cleanup</figcaption></figure><p>You can also subscribe and cleanup with return in useEffect. No need to subscribe to componentDidMount and clean it in componentWillUnmount!</p><blockquote><em>For more information, please refer to this link : </em><a href="https://reactjs.org/docs/hooks-intro.html"><em>https://reactjs.org/docs/hooks-intro.html</em></a></blockquote><h3>With all of these advantages, we’d highly recommend using React Hooks. How about you?</h3><p>Please feel free to share your thoughts with us below. Thank you for reading!</p><p>If you would like to join Manabie and work together to create a positive impact in education, visit us at: <a href="https://slack-redir.net/link?url=https%3A%2F%2Fmanabie.com%2Fcareers">manabie.com/careers</a>.</p><blockquote>This article is also posted on Manabie Tech Blog. <a href="https://medium.com/manabie/why-you-should-consider-moving-to-react-hooks-55abe350ca7b">https://medium.com/manabie/why-you-should-consider-moving-to-react-hooks-55abe350ca7b</a></blockquote><blockquote>This is my company’s blog, and it also includes a lots of helpful articles. Please visit if you are interested.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84886c7fa79b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>