<?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 chr.vadala on Medium]]></title>
        <description><![CDATA[Stories by chr.vadala on Medium]]></description>
        <link>https://medium.com/@chr.vadala?source=rss-f6833fc76c70------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VJCJlBfVF0g9YJh2XaHERw.png</url>
            <title>Stories by chr.vadala on Medium</title>
            <link>https://medium.com/@chr.vadala?source=rss-f6833fc76c70------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 12:50:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chr.vadala/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 and how I made react-refactor]]></title>
            <link>https://medium.com/@chr.vadala/react-refactor-why-and-how-i-made-it-9b582aa63eb1?source=rss-f6833fc76c70------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b582aa63eb1</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[chr.vadala]]></dc:creator>
            <pubDate>Mon, 19 Feb 2018 13:01:02 GMT</pubDate>
            <atom:updated>2018-02-19T13:01:02.204Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>I was frustrated by how many times I had to convert a <strong>React Class component</strong> to a <strong>React Functional component</strong> and vice-versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3QYDjC3QwG1njtuU." /><figcaption>Photo by <a href="https://unsplash.com/@nikkotations?utm_source=medium&amp;utm_medium=referral">nikko macaspac</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>React Functional </strong>components are Javascript functions that return a React element. They don’t have any state or hooks capability and they are really useful to make pure components without any specific logic. They are also known as <strong>stateless components</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6432bd9ef64a91218e2f4d70c78cc772/href">https://medium.com/media/6432bd9ef64a91218e2f4d70c78cc772/href</a></iframe><p><strong>React Class components </strong>are Javascript ES6 Class that extend the object React.Component (or React.PureComponent). They support some hooks that are indispensable in some situations, but they are usually chosen for the state capability. They are also known as stateful component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fc385b3728dd820e53b7cf953646730/href">https://medium.com/media/7fc385b3728dd820e53b7cf953646730/href</a></iframe><p>A good article that compares stateless and stateful component is available <a href="https://hackernoon.com/react-stateless-functional-components-nine-wins-you-might-have-overlooked-997b0d933dbc">here</a>.<br> <br>When I started to make <strong>React Refactor</strong> I asked myself which was the better method to manipulate Javascript code and I found that Babel does the job very well. I used it in a lot of situations, but I’d never made a plugin on it. After more research into Babel plugins I wasn’t sure that it could handle the full code replacement that I needed. I preferred not to take this path but I will probably investigate it more.<br>In the end I preferred to use <a href="https://github.com/babel/babel/tree/master/packages/babylon">Babylon</a> a Javascript parser that is able to read any JS code and convert to its AST rappresentation. An AST representation is an object tree that describes each Javascript part associated with start and end offsets. To work with AST I found AST explorer, an awesome online tool that is able to display AST trees.</p><p>I preferred to make three different packages, using <a href="https://github.com/lerna/lerna">Lerna</a> monorepo system: <br>- <a href="https://github.com/chrvadala/react-refactor/tree/master/packages/react-refactor"><strong>reat-planner</strong></a>, a Javascript library that can be used to create tools and utilities; <br>- <a href="https://github.com/chrvadala/react-refactor/tree/master/packages/react-refactor-gui"><strong>react-planner-gui</strong></a>, a web interface, written in React, that can be used on the fly without installing anything;<br>- <a href="https://github.com/chrvadala/react-refactor/tree/master/packages/react-refactor-cli"><strong>react-planner-cli</strong></a>, a command line tool that can be locally installed.</p><p><strong>Github project page</strong> <a href="https://github.com/chrvadala/react-refactor">https://github.com/chrvadala/react-refactor</a><br><strong>Online DEMO</strong> <a href="https://chrvadala.github.io/react-refactor/">https://chrvadala.github.io/react-refactor</a><br><strong>My Profile</strong> <a href="https://github.com/chrvadala">https://github.com/chrvadala</a></p><p>If you have any kind of suggestions feel free to comment on this article or open a new issue on Github.</p><p>I hope that my work will speed up your work!</p><p>Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b582aa63eb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>