<?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 Danail Hadjiatanasov on Medium]]></title>
        <description><![CDATA[Stories by Danail Hadjiatanasov on Medium]]></description>
        <link>https://medium.com/@danailh?source=rss-843afe9cd0cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*g9Lk-OpbYsu8ERg0ebcmpw.jpeg</url>
            <title>Stories by Danail Hadjiatanasov on Medium</title>
            <link>https://medium.com/@danailh?source=rss-843afe9cd0cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 11:39:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danailh/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[Learning React in 2021/2022]]></title>
            <link>https://danailh.medium.com/learning-react-in-2021-2022-5deb926e29ce?source=rss-843afe9cd0cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5deb926e29ce</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Danail Hadjiatanasov]]></dc:creator>
            <pubDate>Sun, 03 Oct 2021 11:21:58 GMT</pubDate>
            <atom:updated>2021-10-03T11:21:58.118Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VapRaFaziXAoo6v5.jpg" /></figure><h3>Introduction</h3><p>Today, <strong><em>React.js</em></strong> is one of the most popular and widely used front-end web technology. It is a JavaScript library used to build user interfaces. There are several reasons why <em>React</em> is preferred over other frontend frameworks. These include high performance, easy to learn and use, flexibility, and strong community support.</p><p>Learning <em>React</em> in 2021 is a great decision. <em>React’s</em> popularity is increasing year by year. <em>React</em> is comparatively easier to learn but to become a professional and successful React developer, you need to learn more than <em>React</em>. In simple words, only <em>React</em> is not enough.</p><p>To become a professional <em>React</em> frontend developer, you need to follow a proper roadmap. In this article, we will create a roadmap for <em>React</em> developers to learn <em>React</em> from starting in 2021/2022.</p><h3>Basics of web development</h3><p>Before jumping to <em>React</em>, every <em>React</em> developer needs to understand the basics of web development properly. <strong><em>HTML</em></strong>, <strong><em>CSS</em></strong>, and <strong><em>JavaScript</em></strong> are the core technologies of the <em>World Wide Web</em> (WWW) and if you have even a pinch of web development knowledge, you may know what these terms are.</p><h4>HTML</h4><p>The very first term you need to understand is <em>HTML</em>. Hypertext Markup Sheet, commonly known as <em>HTML</em>, is considered the skeleton or the basic structure of a web application.</p><p>Out of all the three core technologies, <em>HTML</em> is the easiest to learn. <em>HTML5</em> is the last major version of <em>HTML</em>. So to start your career as a React developer in 2021/2022, learn <em>HTML5</em>.</p><h4>CSS</h4><p><em>HTML</em> only creates a structure but modern websites are attractive and appealing. Cascading Style Sheets, commonly known as <em>CSS</em> describes the presentation of an <em>HTML</em> document.</p><p>Modern websites are incomplete without <em>CSS</em> because no one wants a dull, unappealing website. So <em>CSS</em> is one of the most essential skills of a <em>React</em> developer. But unfortunately, many beginners skip <em>CSS</em> without learning it properly.</p><p><em>CSS</em> is vast. You need to grab its basics properly. Moreover, you need to learn <em>CSS</em> concepts such as grid system, flexbox, and very importantly, how to make a responsive website.</p><h4>JavaScript</h4><p><em>JavaScript</em> is probably the most important and toughest of all three core technologies. Most of the websites are using <em>JavaScript</em>, thus making it the primary language of modern front-end web development.</p><p><em>React</em> uses <em>JSX</em>, which is an extension of <em>JavaScript</em>. So, learning <em>JavaScript</em> should be your top priority before jumping to <em>React</em>.</p><p>First, you need to learn the basic programming concepts. Then, you need to learn the modern features of <em>JavaScript</em>. The language has changed a lot over the years. The <em>ES6</em> and upper versions have introduced new features. Make sure you understand all those major modern features of <em>JavaScript</em>.</p><h3>Other important development skills</h3><p>After learning the basics of web development, you need to focus on some other concepts and tools.</p><h4>DSA</h4><p>A professional developer doesn’t matter frontend or backend is always expected to understand the <em>DSA</em>, meaning, data structures, and algorithms.</p><p>Building something is one thing and building something with better efficiency is another. Having the knowledge of <em>DSA</em> ensures that you know how to develop efficiently.</p><h4>GIT</h4><p>When you become a professional <em>React</em> developer, you won’t be working alone. You would need to record what you are doing, so you and your teammates can track your work.</p><p><em>GIT</em> is the most popular version control system and every professional developer should know how to use <em>GIT</em>.</p><h4>Terminal</h4><p>Using a terminal is not a big deal but you should be familiar with it and how to use its commands.</p><h3>Starting with React</h3><p>When your basics are clear and you understand <em>GIT</em> and other necessary development skills, then it is time to move to React.js.</p><h4>Understand React</h4><p>Never jump directly to the coding part, first understand what <em>React</em> exactly is. Try to understand how <em>React</em> works behind the scenes and why in the first place people are using <em>React</em>. Try to understand virtual <em>DOM</em> and one-way data binding.</p><h4>Build tools</h4><p>Following is the list of build tools, package managers, and task runners that you should be familiar with.</p><p>⇒ Node Package Manager (NPM) or yarn</p><p>⇒ Webpack</p><p>⇒ npm scripts</p><h4>React CLI, JSX, and components</h4><p>After understanding <em>React</em> and build tools, learn how to create a <em>React</em> app using react <em>CLI</em>. Then, the most important part is <em>JSX</em>. You need to learn what <em>JSX</em> is and how to create components using it. <em>React</em> has two types of components — class and functional. Learn both!</p><h4>State and props</h4><p>A React component is made up of state and props. The state is controlled within the component while props are passed from a parent component to a child component. When you are going to work on a real-time project, you are probably going to use the state and props more than anything else. So it is very important to learn these concepts properly.</p><h4>Lifecycle methods</h4><p>React provides several in-built lifecycle methods such as <strong><em>componentDidMount</em></strong>, <strong><em>componentDidUpdate</em></strong>, and <strong><em>shouldComponentUpdate</em></strong>. These methods are supported only in class components but still, you should be familiar with them</p><h4>Routing</h4><p>A web application is incomplete without routing. In <em>React</em>, the <em>React router</em> library is generally used for routing. Understand the basics of routing and how to implement it in a <em>React</em> application.</p><h3>Advanced React concepts</h3><p>After clearing the basic concepts, jump to the advanced <em>React</em> concepts. The following are very important because modern <em>React</em> applications are not complete without them. So give them extra attention.</p><h4>React hooks</h4><p>Earlier, <em>React</em> was almost class-based because state and lifecycle methods were not supported by functional components. But since the introduction of <em>React</em> hooks, everything is changing.</p><p>Functional components are being preferred over class components because of <em>React hooks</em>. So a <em>React</em> developer in 2021/2022 needs to learn and understand <em>React hooks</em>.</p><p>Some of the commonly used <em>React hooks</em> you should learn properly are</p><p>⇒ useState</p><p>⇒ useEffect</p><p>⇒ useContext</p><p>⇒ useReducer</p><h4>State management</h4><p><em>State</em> in <em>React</em> should be managed efficiently. In <em>React</em>, the state can be managed in a class component using the <em>setState()</em> method and in functional components using the<em> useState()</em> hook. Understand both of these state management ways properly. Another way is using the context API.</p><p>But as the application grows, it becomes difficult to manage the state. So the third-party libraries such as <strong><em>Redux</em></strong> and <strong><em>Mobx</em></strong> are used for state management.</p><h4>Redux</h4><p><em>Redux</em> is the most popular state management library. Every <em>React</em> developer is expected to know what <em>Redux</em> is and how it is used with <em>React</em>. So learn what is <em>Redux</em> and how to implement it.</p><p>As mentioned above, a <em>React</em> developer needs to have knowledge of <em>Redux</em>. But <em>Redux</em> itself is a <em>JavaScript</em> library. So there are many concepts that a react developer should be familiar with. Following is the list of some of the important concepts that you should learn.</p><p>⇒ Redux-thunk</p><p>⇒ Redux saga</p><p>⇒ Redux observable</p><p>⇒ Helpers (rematch and reselect)</p><p>Moreover, you should also learn the react-redux hooks such <strong><em>useDispatch</em></strong> and useSelector.</p><h4>HTTP requests</h4><p>In <em>React</em>, <em>HTTP</em> requests are handled using the <strong><em>fetch</em></strong> API or <strong><em>Axios</em></strong>. While the fetch API is in-built, <em>Axios</em> is a third-party library. Though <em>Axios</em> is used more commonly in React for handling <em>HTTP</em> requests, you should be familiar with the fetch API as well.</p><h4>Forms</h4><p>Forms are commonly used on the web for registrations, login, feedback, etc. They should be attractive and better performing. In <em>React</em>, creating a basic working form is easy but when the forms are huge, it becomes tough to create and maintain them. So form helpers are created for React developers.</p><p>The most popular form helper is <strong><em>Formik</em></strong>. It is basically a <em>JavaScript</em> library. Another commonly used <em>forms</em> helper is the <em>Redux</em> form. It is also a <em>JavaScript</em> library that manages the state of a form in <em>React</em>. So it is recommended to learn at least one or both of them.</p><h4>Other important concepts</h4><p>Following is the list of other concepts that you should pay attention to.</p><p>⇒ Render props</p><p>⇒ Higher-order components</p><p>⇒ Lifting the state up</p><p>⇒ Custom hooks</p><p>⇒ Lists and keys</p><p>⇒ Refs</p><p>⇒ Error boundaries</p><h3>Styling</h3><p>As mentioned earlier in this article. no website is complete without <em>CSS</em>. After learning the basics of <em>CSS</em>, you need to learn additional libraries and concepts to become a professional <em>React</em> frontend developer.</p><p>It is always expected from a <em>React</em> developer to have knowledge of at least one <em>CSS</em> framework. <strong><em>Bootstrap</em></strong> is one of the most popular <em>CSS</em> frameworks. Apart from bootstrap, a <em>React</em> developer should also be familiar with UI libraries such as <strong><em>MUI</em></strong> (previously <em>Material-UI</em>) and <strong><em>Prime React</em></strong>.</p><p>Other important concepts related to styling are <em>CSS</em> preprocessors such as Sass. Also, “styled-components” is an emerging way of using <em>CSS</em> in <em>JavaScript</em>.</p><h3>Testing</h3><p>As a developer, you might not be expected to be a testing expert but in the modern developer, a developer should be familiar with how the testing is done.</p><h3>Unit testing</h3><p>Out of all the different types of testing, a <em>React</em> developer is expected to understand unit testing properly. You should be familiar with at least one of the React unit testing libraries. Some of the popular unit testing libraries are <strong><em>Jest</em></strong>, <strong><em>Enzyme</em></strong>, <strong><em>React Testing Library</em></strong>, and <strong><em>Mocha</em></strong>.</p><h4>E2E testing</h4><p>End to End testing is another important type of testing that a <em>React</em> developer should be familiar with. <strong><em>Selenium</em></strong> is the most popular <em>E2E</em> testing framework.</p><h4>Integration testing</h4><p>Knowledge of integration testing is always a plus point. If you have time, try to learn at least one integration testing library. <strong><em>Karma</em></strong> is the most popular integration testing library with <em>React</em>.</p><h3>Practice</h3><p>Learning <em>React</em> is one thing and using it to develop something is another. Once your React concepts are cleared, you need to practice <em>React</em>.</p><h4>Starting</h4><p>Start by designing a simple <em>React</em> application. For example, create a form in which a user can input different values. Once the button is clicked, the values are displayed below. Another simple project is a calculator or a counter.</p><h4>Go with hooks and other concepts</h4><p>Next, try to create an application by using hooks. <em>React hooks</em> are very important. So try to use as many hooks as you can.</p><p>Try to use routing, different styles, and form helpers. Moreover, also try to write testing using any of the testing libraries.</p><h4>Implement redux</h4><p>As mentioned earlier, <strong><em>Redux</em></strong> is an essential part of <em>React</em>. Create an application and implement redux in it. You can think of an application with multiple components sharing one state. So use redux to share the state among these components.</p><h4>Go big</h4><p>Once your learning is done and you have practiced enough, try to create something big using <em>React</em> and <em>Redux</em> such as an e-commerce website. Observe the websites such as Amazon to take an idea and then start building your big <em>React</em> application. Try to implement every concept you learned during your <em>React</em> journey.</p><h4>After React</h4><p>After you are done with <em>React</em>, you can move further if you want. Though this section is not compulsory, it will be great for your career.</p><p>Following is the list of technologies that a <em>React</em> developer can go for once he/she is done with <em>React</em>.</p><p><strong><em>⇒ Server-side rendering</em></strong></p><ol><li>Next.js</li><li>After.js</li></ol><p><strong><em>⇒ Mobile development</em></strong></p><ol><li>React native</li><li>Cordova</li></ol><p><strong><em>⇒ Desktop development</em></strong></p><ol><li>Electron</li><li>React native windows</li></ol><h3>Final thoughts</h3><p><em>React</em> journey is not going to be short or easy. There is so much in <em>React</em>. So that’s why we created a roadmap for <em>React</em> beginners.</p><p>Learning <em>React</em> will take time. You need to clear your basics before jumping to <em>React</em> and when you are in <em>React</em>, you need to understand the <em>React</em> basics before jumping to advanced topics.</p><p>Practice is the key to success. So after learning <em>React</em>, practice as much as you can. Create different projects and use everything you learned.</p><p>Once you are done with <em>React</em>, go for other platforms such as mobile or desktop development. You can also choose server-side rendering technologies such as <strong><em>Next.js</em></strong>.</p><p>Happy learning!</p><p><em>Originally published at </em><a href="https://www.thenovelty.dev/post/learning-react-in-2021-2022"><em>https://www.thenovelty.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5deb926e29ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Render Props Basics]]></title>
            <link>https://danailh.medium.com/react-render-props-basics-e2da4eef9c48?source=rss-843afe9cd0cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2da4eef9c48</guid>
            <category><![CDATA[render-props]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Danail Hadjiatanasov]]></dc:creator>
            <pubDate>Fri, 24 Sep 2021 09:39:39 GMT</pubDate>
            <atom:updated>2021-09-24T09:39:39.916Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JCVJjQo9gcH7auBc" /><figcaption>Photo by <a href="https://unsplash.com/@sunawang?utm_source=medium&amp;utm_medium=referral">Aliko Sunawang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Generally, a React application is made up of several components. As the application grows, we may encounter a situation where the same piece of code is being used in more than one component. Writing the same code in multiple places across the application is pointless, right? So React provides a brilliant way to share code among the components. It is called <strong><em>render props</em>.</strong>‍</p><h3>Props in React</h3><p>Props and state are two essential parts of a React component. While the state is controlled from within the component, props are passed from the parent component to a child component. In other words, props are controlled by another component.</p><p>Generally, props are objects that, unlike the state, are immutable. React has a unidirectional flow, meaning data can be passed from the parent component to the child component. Props are data but <strong><em>render props</em></strong> are a bit different from general prop data.‍</p><h3>Render props</h3><p>So as mentioned above, props are data passed from one component to another. <strong><em>render props</em></strong> is something similar. It is an advanced technique using which “code is shared” among components. Yes, instead of the usual data, we can also pass the code from one component to another in React.</p><p>For example, observe the following code.‍</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/0*lZ0Q6d51hb5NMgzW.png" /></figure><p>In the above example, <strong><em>demoFun</em></strong> is passed as a prop to the <strong><em>Child </em></strong>component.‍</p><p><strong><em>demoFun</em></strong> is a piece of code, so we are using render props.‍</p><h3>Understanding render props</h3><p>Let’s try to understand render props step by step with the help of a working example. Observe the following code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*zuY769WM8TxcpDTh.png" /></figure><p>In the above code, a state named <strong><em>count </em></strong>is defined using the <strong><em>setState()</em></strong> hook. There is a button in the component that increases the value of <strong><em>count </em></strong>with every click. The value of <strong><em>count</em></strong> is displayed below the button.</p><p>Now, suppose, we need another button that will decrement the value of <strong><em>count </em></strong>by 1 on every click, but this button should be present in the child component of the <strong><em>App</em> </strong>component. How can we do this? The state is present in the parent component and how to update it from the child component? Well, there can be different ways to solve this problem. Let’s use render props here.</p><p>In the <strong><em>App</em></strong> component, add the following function.‍</p><pre>const decrementHandler = () =&gt; {<br>  setCount(count - 1);<br>};</pre><p>Now, observe the <strong><em>Child</em></strong> component.‍</p><pre>const Child = (props) =&gt; {<br>  return &lt;button onClick={}&gt;Subtract&lt;/button&gt;;<br>};</pre><pre>export default Child;</pre><p>As of now, the <strong><em>Child </em></strong>component has a button but it does nothing when clicked. To make things work, we need to invoke <strong><em>decrementHandler </em></strong>when this button is clicked, but the <strong><em>decrementHandler</em></strong> is in the parent component. This is where render props enter.</p><p>We have to pass <strong><em>decrementHandler</em></strong> as a prop from the <strong><em>App </em></strong>component to the <strong><em>Child </em></strong>component.</p><pre>return (<br>  &lt;React.Fragment&gt;<br>    &lt;button onClick={incrementHandler}&gt;Click here&lt;/button&gt;<br>    &lt;h2&gt;{ count }&lt;/h2&gt;<br>    &lt;Child handler={decrementHandler} /&gt;<br>  &lt;/React.Fragment&gt;<br>);</pre><p>‍Now in the <strong><em>Child </em></strong>component, we can use the <strong><em>decrementHandler</em></strong> with the button.</p><p>Let’s use it in the <strong><em>Child</em></strong> component.</p><pre>const Child = (props) =&gt; {<br>  return &lt;button onClick={props.handler}&gt;Subtract&lt;/button&gt;;<br>};</pre><pre>export default Child;</pre><p>This is how the <strong><em>App</em></strong> component looks.‍</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*42L80ez04Ek2MjPC.png" /></figure><p>Let’s understand what is happening in the application.</p><ul><li><strong><em>App</em></strong> component has a button that increments the value of <strong><em>count </em></strong>by 1 whenever it is clicked.</li><li><strong><em>Child</em></strong> is the child component of the <strong><em>App </em></strong>component and it also contains a button.</li><li>The button in the <strong><em>Child </em></strong>component decrements the value of <strong><em>count </em></strong>by 1 whenever it is clicked.</li><li>The state <em>(count)</em> is present in the <strong><em>App </em></strong>component, so we created both the functions to handle increment and decrement in it only.</li><li>But the decrement function, i.e. <strong><em>decrementHandler</em></strong> is required in the <strong><em>Child</em></strong> component</li><li>So, the <strong><em>decrementHandler</em></strong> is passed as a prop to the <strong><em>Child </em></strong>component, thus using <strong><em>render props</em></strong>.‍</li></ul><h3>Wrapping it up</h3><p>In simple words, the technique of passing code (or function) from a parent component to a child component as props is known as render props. It is a simple yet very useful technique. Like in this article, we had a state in the parent component which was to be mutated by the child component. So instead of using something more complex like redux, we used much simpler and easier render props.</p><p><em>Originally published at </em><a href="https://www.thenovelty.dev/post/react-render-props-basics"><em>https://www.thenovelty.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2da4eef9c48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What The Context !?]]></title>
            <link>https://danailh.medium.com/what-the-context-eaabc029f676?source=rss-843afe9cd0cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaabc029f676</guid>
            <category><![CDATA[react-context]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react-context-api]]></category>
            <dc:creator><![CDATA[Danail Hadjiatanasov]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 19:14:56 GMT</pubDate>
            <atom:updated>2021-09-02T19:14:56.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HfGeqw4LY56J2F1-" /><figcaption>Photo by <a href="https://unsplash.com/@mohammadtkh?utm_source=medium&amp;utm_medium=referral">mohammad takhsh</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What The Context !?</h3><p><em>The following is based on a tach talk I did for JS World Conference Amsterdam. You can find the test code here:</em> <a href="https://github.com/DanailH/jsworldconference-2021">https://github.com/DanailH/jsworldconference-2021</a></p><h3>Introduction</h3><p>React Context is one of the most powerful features of React. Using React Context API, we can create global variables that can be passed around anywhere in the application. It is basically an alternative to prop drilling or even to state management libraries such as redux to some extent.</p><p>Before moving to React Context API, let’s discuss prop drilling and state management in React.</p><h3>Prop drilling</h3><p>Props in React are properties that are passed from a parent component to a child component. They are read-only data and are passed in the form of plain JavaScript objects.</p><p>Passing props from the grandparent component to the parent component and further to the child component and so on, is known as prop drilling. It is not a big deal to pass data from a parent component to a child component but prop drilling can become a problem.</p><h3>State management</h3><p>Props are not the only part of composable React components. Another important aspect of building composable React components is the React state.</p><p>The state of a component controls its behavior. In React, we can have a component-level state as well as a global state. While React provides in-built support for component-level state, it is recommended to use third-party libraries for managing the global state.</p><p>Redux is the most popular state management library. Though it is absolutely fine to use Redux, its implementation is quite complicated. Redux should be used when the application is huge. But when the application is not that huge, we may feel implementing Redux is time-consuming and requires more effort.</p><h3>Understanding the need for React Context API</h3><p>Why do we actually need to care about the React Context API when everything is fine with prop drilling and redux? Suppose we have five components in our React application — App, Component 1, Component 2, Component 3, and Component 4.</p><p>The structure is as follows:</p><pre>App -&gt; Component1 -&gt; Component2 -&gt; Component3 -&gt; Component4</pre><p>Suppose we need to pass the value of <em>count</em> from the <em>App</em> component to <em>Component4</em>. We can simply pass <em>count</em> as prop from <em>App</em> to <em>Component1</em>, then from <em>Component1</em> to <em>Component2</em>, then from <em>Component2</em> to <em>Component3</em>, and finally from <em>Component3</em> to <em>Component4</em>. Everything will work fine, but there is no need of <em>count</em> in <em>Component1</em>, <em>Component2</em>, and <em>Component3</em>, right? These components are receiving and passing down the props unnecessarily.</p><p>With the React Context API, we can avoid this unnecessary involvement of the middle components. The <em>context</em> will only involve the <em>App</em> component and the component that requires the prop, i.e. <em>Component4</em>.</p><p>Another situation where we may need Context API is for global state management. As mentioned earlier in this article, heavy implementation of Redux can be avoided if the application is not that big. Moreover, the introduction of the <em>useContext() </em>hook has made the job easier.</p><h3>Using context to avoid prop drilling</h3><p>We will discuss how to use the Context API to avoid prop drilling with the help of a simple example. This basic React application will consist of four components — <em>App</em>, <em>Component1</em>, <em>Component2</em>, and <em>Button</em>. The structure will be as follows:</p><pre>App -&gt; Component1 -&gt; Component2 -&gt; Button</pre><p>The <em>App</em> component will pass the value for the background color for the button through props. Let’s implement the code.</p><p>Following is the <em>App.js</em> file:</p><pre>import Component1 from &#39;./Component1&#39;;</pre><pre>export default function App() {<br>  const color = &#39;red&#39;;<br>  return (<br>      &lt;div&gt;<br>        &lt;Component1 color={color}/&gt;<br>      &lt;/div&gt;<br>  );<br>}</pre><p>In the above code, the <em>App</em> component renders <em>Component1</em>. The value of color is passed as props.</p><p>Now, observe the <em>Component1.js</em></p><pre>import Component2 from &#39;./Component2&#39;;</pre><pre>const Component1 = (props) =&gt; {<br>  return (<br>    &lt;div&gt;<br>      &lt;Component2 color={props.color}/&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><pre>export default Component1;</pre><p><em>Component1</em> renders <em>Component2</em>. Again the value of color is passed to <em>Component2</em> as props.</p><p>Next, observe the <em>Component2.js</em>.</p><pre>import Button from &#39;./Button&#39;;</pre><pre>const Component2 = (props) =&gt; {<br>  return (<br>    &lt;div&gt;<br>      &lt;Button color={props.color} /&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><pre>export default Component2;</pre><p><em>Button</em> component is being rendered by <em>Component2</em>. Similarly, the value of color coming from <em>Component1</em> is passed to the <em>Button</em> component.</p><p>Finally, we can use the value of color in the <em>Button</em> component.</p><pre>const Button = (props) =&gt; {<br>  return (<br>    &lt;button style={{ backgroundColor: props.color }}&gt;<br>      First button<br>    &lt;/button&gt;<br>  );<br>};</pre><pre>export default Button;</pre><p>This entire code will work as we want but we are involving <em>Component1</em> and <em>Component2</em> unnecessarily. Let&#39;s see how we can use the React Context API to simplify the solution.</p><p>Let’s create the equivalent of the above application using context.</p><p>First, we need to create a context. So let’s create a file solely for the context.</p><pre>import React from &#39;react&#39;;</pre><pre>const AppContext = React.createContext();</pre><pre>export default AppContext;</pre><p>To create a context, we need to import React from <em>‘react’</em> and use it to invoke the <em>createContext()</em> method. Now, we can use it in other files.</p><p>Remember, we only need to involve two files — one that is sending data (<em>App.js</em>) and the other that is receiving data (<em>Button.js</em>).</p><p>So let’s start with <em>App.js</em>.</p><pre>import AppContext from &#39;./AppContext&#39;;<br>import Component1 from &#39;./Component1&#39;;</pre><pre>export default function App() {<br>  return (<br>    &lt;AppContext.Provider value={{ color: &quot;red&quot; }}&gt;<br>      &lt;div&gt;<br>        &lt;Component1 /&gt;<br>      &lt;/div&gt;<br>    &lt;/AppContext.Provider&gt;<br>  );<br>}</pre><p><em>App.js</em> is the sender. In other words, <em>App.js</em> is the provider. So using the c<em>ontext</em> we created, we use the <em>Provider</em> and pass the value through it.</p><pre>&lt;AppContext.Provider value={{ color: &quot;red&quot; }}&gt;</pre><p>Now, let’s use this value in the <em>Button</em> component.</p><pre>import AppContext from &#39;./AppContext&#39;;</pre><pre>const Button = () =&gt; {<br>  return (<br>    &lt;AppContext.Consumer&gt;<br>      {(value) =&gt; (<br>        &lt;button style={{ backgroundColor: value.color }}&gt;<br>          First button<br>        &lt;/button&gt;<br>      )}<br>    &lt;/AppContext.Consumer&gt;<br>  );<br>};</pre><pre>export default Button;</pre><p>First, we need to import the <em>context</em> here also because just like the <em>Provider</em>, we need the <em>Consumer</em> to use the <em>context</em>.</p><pre>&lt;AppContext.Consumer&gt;</pre><p>Now, we can use the value that we passed through the <em>Provider</em>.</p><pre>&lt;AppContext.Consumer&gt;<br>  {(value) =&gt; (<br>    &lt;button style={{ backgroundColor: value.color }}&gt;<br>      First button<br>    &lt;/button&gt;<br>  )}<br>&lt;/AppContext.Consumer&gt;</pre><p>That’s it! The value passed from the <em>App</em> component is accessible in the <em>Button</em> component. No other component was involved.</p><h3>Using Context for state management</h3><p>As discussed earlier, we can use the React Context API for moderate state management. Let’s understand with the help of an example.</p><p>To understand this example, you should have knowledge of React hooks. We will use two React hooks — <em>useContext</em> and useReducer.</p><p>According to official React documentation, the <em>useContext</em> hook is equivalent to the <em>&lt;MyContext.Consumer&gt;</em>. We will use this hook because it’s much easier to work with it. Another hook is <em>useReducer</em> which will help us implement reducer-like functionality without Redux.</p><p>We will create a simple React application with three components. Two of these components will have a button. These two buttons will manipulate the state and the state will be displayed in the third component. So we will have a global state which will be shared by all the components.</p><p>The working of the application is as follows:</p><ul><li>The initial value of state is 0 and it is displayed in the Display component.</li><li>The first button will increase the value by one.</li><li>The second button will decrease the value by one.</li></ul><p>Let’s start by creating the <em>context</em> for the application.</p><pre>import React from &#39;react&#39;;</pre><pre>const AppContext = React.createContext();</pre><pre>export default AppContext;</pre><p>We need a reducer. Let’s create one.</p><pre>const reducer = (state, action) =&gt; {<br>  switch (action) {<br>    case &#39;ADD&#39;:<br>      return {<br>        value: state.value + 1<br>      };<br>    case &#39;SUB&#39;:<br>      return {<br>        ...state,<br>        value: state.value - 1<br>      };<br>    default:<br>      return state;<br>  }<br>};</pre><pre>export default reducer;</pre><p>The reducer can increment the value by one or decrement it by one.</p><p>We have the <em>context</em> and reducer. Now, we can use both of them in the <em>App.js</em> file.</p><pre>import { useReducer } from &#39;react&#39;;<br>import Button1 from &#39;./Button1&#39;;<br>import Button2 from &#39;./Button2&#39;;<br>import Display from &#39;./Display&#39;;<br>import AppContext from &#39;./AppContext&#39;;<br>import reducer from &#39;./reducer&#39;;</pre><pre>export default function App() {<br>  const intialState = { value: 0 };<br>  const [state, dispatch] = useReducer(reducer, intialState);</pre><pre>return (<br>    &lt;AppContext.Provider value={{ state, dispatch }}&gt;<br>      &lt;div&gt;<br>        &lt;Button1 /&gt;<br>        &lt;Button2 /&gt;<br>        &lt;Display /&gt;<br>      &lt;/div&gt;<br>    &lt;/AppContext.Provider&gt;<br>  );<br>}</pre><p>Observe the following lines.</p><pre>const intialState = { value: 0 };<br>const [state, dispatch] = useReducer(reducer, intialState);</pre><p>First, we created an initial state. Using the <em>useReducer</em> hook, we create a state and a dispatch function. Remember, we have to pass the reducer and initial state to this hook.</p><p>Next, we will use the <em>state</em> and the <em>dispatch</em> function with the <em>Provider</em>.</p><pre>&lt;AppContext.Provider value={{ state, dispatch }}&gt;</pre><p>Now we can use the <em>state</em> and <em>dispatch</em> anywhere in the application. Let’s start by dispatching the actions on button click.</p><p>Observe the <em>Button1.js</em> file.</p><pre>import { useContext } from &#39;react&#39;;<br>import AppContext from &#39;./AppContext&#39;;</pre><pre>const Button1 = () =&gt; {<br>  const Context = useContext(AppContext);</pre><pre>  return (<br>    &lt;button onClick={() =&gt; Context.dispatch(&#39;ADD&#39;)}&gt;ADD&lt;/button&gt;;<br>)};</pre><pre>export default Button1;</pre><p>To use the dispatch function, we need the <em>useContext</em> hook.</p><pre>const Context = useContext(AppContext);</pre><p>Now we can use the dispatch function.</p><pre>&lt;button onClick={() =&gt; Context.dispatch(&#39;ADD&#39;)}&gt;ADD&lt;/button&gt;;</pre><p>Similarly, we can use the dispatch function in the <em>Button2.js</em> file.</p><pre>import { useContext } from &#39;react&#39;;<br>import AppContext from &#39;./AppContext&#39;;</pre><pre>const Button2 = () =&gt; {<br>  const Context = useContext(AppContext);<br> <br>  return (<br>    &lt;button onClick={() =&gt; Context.dispatch(&#39;SUB&#39;)}&gt;SUB&lt;/button&gt;;<br>)};</pre><pre>export default Button2;</pre><p>Now, the state will be updated accordingly.</p><p>Next, we have to use the state in the <em>Display</em> component.</p><pre>import { useContext } from &#39;react&#39;;<br>import AppContext from &#39;./AppContext&#39;;</pre><pre>const Display = () =&gt; {<br>  const CountCounter = useContext(AppContext);<br>  const value = CountCounter.state.value;</pre><pre>  return &lt;h2&gt;{value}&lt;/h2&gt;;<br>};</pre><pre>export default Display;</pre><p>Again we have to use the <em>useContext</em> hook but this time for accessing the state.</p><pre>const CountCounter = useContext(AppContext);<br>const value = CountCounter.state.value;</pre><p>Every time the state is updated by any button, it will be updated in the <em>Display</em> component as well.</p><h3>Wrapping it up</h3><p>Props and state are two important aspects of React. Both of them should be used efficiently. If we don’t handle them properly, we may end in unwanted situations like prop drilling. React Context API is an advanced and very powerful feature that can be used to avoid such unwanted situations.</p><p>In this article, we discussed what React Context API is and how it is used to avoid prop drilling. We further discussed how the Context API can be used as an alternative to Redux in moderate state management.</p><p>Using Context API is not tough. We have to create a c<em>ontext</em> using React’s <em>createContext</em> method. Then we have to use the context’s <em>Provider</em> and Consumer to pass and use the value respectively. With the <em>useContext</em> and <em>useReducer</em> hooks, we can work with context more easily and simply.</p><p><em>PS: This was originally published here </em><a href="https://www.thenovelty.dev/post/what-the-context"><em>https://www.thenovelty.dev/post/what-the-context</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaabc029f676" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching a SaaS product]]></title>
            <link>https://danailh.medium.com/launching-a-saas-product-ba0f3eed0a37?source=rss-843afe9cd0cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba0f3eed0a37</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <category><![CDATA[software-product]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Danail Hadjiatanasov]]></dc:creator>
            <pubDate>Thu, 17 Dec 2020 13:58:54 GMT</pubDate>
            <atom:updated>2020-12-17T13:58:54.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4TLlisFk7XvtREAsS7C7Q.jpeg" /></figure><p>As the year comes to an end I want to share my experience with launching a SaaS product. COVID had a massive impact in the world and if you just check the amount of new SaaS services that had popped up this year you will be surprises, it’s like the new gold rush. The good news about this is that obviously SaaS products do work but there are some key steps that you need to do to ensure that you are not wasting your time developing something that nobody wants but enough intro, let’s dive in.</p><p>It might be a bit daunting to launch a SaaS service. You might not be sure how to do it. There are so many things to focus on; you might not even know where to begin. You might feel so overwhelmed that you want to drop the product. If you do feel this way, don’t worry. Here’s how you can grow your product:</p><h3>Set up phase</h3><p>As tempting as it is to set up your business, you have to make sure that your software product will have a certain number of customers. One way is to calculate the total addressable market (TAM). It’s pretty simple. The formula is the number of available customers*value of each customer. If the value of TAM&gt; $1,000,000, you’re good to go! However, if it is not, move on. Look for other options. Another way, and I think the more correct one is go do a bottom up approach where you identify the smallest subset of people (your early adopters) that would benefit from your product and develop something that is specifically designed to solve their immediate problem. It might sound strange but trust me this is much better that targeting a massive market where you have to compete with already established companies.</p><h3>Focus on the product</h3><p>It would be a bit challenging to get the perfect product, but you can do it. One of the first things that you will do is to split your time accordingly. This means 50% of the time should go into the development of the product, and the other 50% should go in for test traction channels.</p><h3>Development phase</h3><p>You need to find a way to get continuous feedback to mold the product according to the consumer’s demands. Remember to refine the product until you can achieve product-market fit, evidenced by a high retention rate. To get this high retention rate, you could focus on the steps laid out by the marketing expert Seth Godin. According to Seth, you can:</p><blockquote><strong>Talk about the story of ME: you should explain why the product is here.</strong></blockquote><blockquote><strong>You should talk about the story of US: why it is your story.</strong></blockquote><blockquote><strong>You can also discuss the story of now: IN other words, why you should care about the product today instead of tomorrow.</strong></blockquote><p>Remember, this is only one half of developing your product. The next thing that you have to do is to test your product with different channels.</p><h3>Testing channels</h3><p>You can go through different traction channels, such as targeting niche blogs and encouraging media mentions. This will help you to grow your product and to make people aware of it. Then, you can also do unconventional PR, paid search, content marketing, and email marketing to see how you can grow your product. However, at one time, you should only test 3 channels. You don’t want to overdo it.</p><p>Remember, your goal here is to identify where your customers are at. Once you have that base, you can move from there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1zYIJygSFLz3XSXa.jpg" /></figure><h3>Build yourself a roadmap</h3><p>Now that you have some ideas about the customer base, and you have decided that your product is worthy of being sold, you can focus on building a roadmap.</p><p><strong><em>Goal, Mission and Statement</em></strong></p><p>One of the first things that you should do is to identify a goal. For instance, let’s assume your goal is to get a $5000 profit every month. This is not a random figure. You should calculate the figure by aligning the price with the value of the product.</p><p>Once you have done that, you should focus on the mission of your company. It is something that should be simple and on the landing page so everyone can remember it. For instance, try to do it Nike style. Don’t mention the product. Just what the brand stands for.</p><p>Your positioning statement should also be here, and ideally, not something that is less than 5 attributes. Remember, the positioning statement must only pass three tests. It must be something that the customer wants; it must be something that you can deliver and of course, it should be better and different from the competitors.</p><p>The goal here is to make it so simple that a potential user can understand the basic concept of what you are offering in a matter of seconds.</p><h4>Month 1</h4><p>Now that you have covered the basics, you should provide the product for free to customers for life. This could help you with the growth of the software product. It could also help you get more customers. These existing customers can tell their friends and family about your products, and before you know it, you have a vast customer base. Remember, it pays to have existing customers talk about your business. It is much easier for the business to grow that way.</p><p>Of course, you can also try the formula of viral growth and see how it goes from there. Your customer base will grow exponentially by networking, collaborating, and sharing stuff on social media platforms. At this time, you should focus on community building.</p><p>Building a community requires a clear mission, openness, and regular interaction with people. Once you do that, more people will hear about the product and want to use it. Bear in mind, when you are building a community, it can become difficult to maintain the quality and you should set up strict standards at your earliest to prevent this stuff from happening. If in the event, you are having trouble building a community because you do not have enough audience members, you can always bootstrap from a common group of followers. It will get easier from there. At this point, you can just promote your landing page on Reddit or Quora as a thread and see how people respond. Remember, avoid promoting the product on startup business; it will ruin your credibility. Perhaps when you have established yourself, you can do so.</p><h4>Month 2</h4><p>Here, you can beta test with 100 users and launch the customer referrals scheme. For instance, you could ask your customer to refer people, and those who do will not have to fees for three years. You should also look into the practice of community building. This time, you could promote on Instagram. The trick is to show the results, not the product. Keep it like Nike. On Twitter, you could have ads targeted at the Instagram channel where you are showing your results.</p><h4>Month 3</h4><p>Dig a little deeper. Analyze how many people are going through your ads and then tweak accordingly. You should also answer questions like ‘Are the customers happy? Are we happy? What can we do to make it better?’ you’ll get your answers and will be able to improve more there.</p><h4>Month 4</h4><p>Here, your focus should be on marketing. Focus on building content to help customers perform better. You could also reach out to influencers and offer your products for free. You also have the option of giving them without tax. Go strong on your engagement game on Twitter and Instagram and get a stronger customer base.</p><h4>Month 5</h4><p>You can focus on giving freebies, books with optimization tricks or some other kind of giveaway. Your aim should be to nurture the clients so that they will be there for the long run. You could also select some users and feature the success stories to become more integrated with the product.</p><h3>Scaling</h3><p>There is really no generic solution for scaling. If you are at this point you should go and check what has worked for you in the past months in terms of customer acquisition channels and focus on those. Remember you don’t need to higher people in order to scale you will be surprised how much more you can accomplish by keeping your operation lean.</p><h3>Last words</h3><p>Yes, it might seem impossible to launch a SaaS product, but you will see it paying off. Just follow the steps, and you’ll get there!</p><p><strong><em>PS: </em></strong>If you already have SaaS product or you are looking to create one you can check out the services we offer at The Novelty Dev web agency. Just submit a project and we will contact you or just shoot us an email at <a href="/service/mailto:team@thenovelty.dev">team@thenovelty.dev</a>. You can also follow us for more articles like this.</p><p><a href="https://www.thenovelty.dev/post/launching-a-saas-product">https://www.thenovelty.dev/</a></p><p>‍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba0f3eed0a37" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>