<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jubayer Hossain</title>
    <description>The latest articles on DEV Community by Jubayer Hossain (@coder71bd).</description>
    <link>https://dev.to/coder71bd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F545711%2F0361e9d2-e781-43bc-8754-80387990d735.png</url>
      <title>DEV Community: Jubayer Hossain</title>
      <link>https://dev.to/coder71bd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/coder71bd"/>
    <language>en</language>
    <item>
      <title>What Is TypeScript?</title>
      <dc:creator>Jubayer Hossain</dc:creator>
      <pubDate>Sat, 05 Mar 2022 03:16:52 +0000</pubDate>
      <link>https://dev.to/coder71bd/what-is-typescript-bh8</link>
      <guid>https://dev.to/coder71bd/what-is-typescript-bh8</guid>
      <description>&lt;p&gt;In One sentence, TypeScript is a superset of JavaScript. It was developed by Microsoft in 2012.&lt;/p&gt;

&lt;p&gt;Let's see why the TypeScript language exists in this world.&lt;/p&gt;

&lt;p&gt;TypeScript solves some common problems of JavaScript by adding some additional features on top of the JavaScript language.&lt;/p&gt;

&lt;p&gt;We know that Javascript is a dynamically typed language. For this, we don't need to think about data types while writing code. But there is some problem. &lt;/p&gt;

&lt;p&gt;Look at the below code snippet to understand the problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const add = (a) =&amp;gt; (b) =&amp;gt; a + b;
add(1)(2) // 3 (expected result)
add(1)('2') // '12' (unexpected result and no error)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see that when we pass two numbers to the add function it gives us a return value which is number as expected. But when we pass a string and a number it gives us another string as a return value which we are not expecting.&lt;/p&gt;

&lt;p&gt;To fix this kind of problem TypeScript implemented the feature of statically typed language in JavaScript. Let's see the above example in typescript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const add: (a: number) =&amp;gt; (b: number) =&amp;gt; number =
    (a) =&amp;gt; (b) =&amp;gt; a + b
console.log(add(1)(2)) // 3 (expected)
console.log(add(1)('2')) // Error --&amp;gt; Argument of type 'string' is not assignable to parameter of type 'number'.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the add function, we have defined that parameters a and b will be number. So when we pass two numbers we get our expected result. But when we pass a number and a string TypeScript compiler gives us an error. In modern IDE, the error will be shown instantly after writing the line. You don't need to compile it to catch this kind of error. &lt;/p&gt;

&lt;p&gt;Does TypeScript replace JavaScript?&lt;br&gt;
The answer is no. As browsers still don't understand the TypeScript language, we have to compile our TypeScript code to JavaScript for making the code workable.&lt;/p&gt;

&lt;p&gt;We have seen what typescript is in short. But it has some huge topics to explore. Check their &lt;a href="https://www.typescriptlang.org/"&gt;official documentation&lt;/a&gt; to know more.&lt;br&gt;
There is also a &lt;a href="https://www.typescriptlang.org/play"&gt;playground&lt;/a&gt; to play with the typescript language.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>intro</category>
    </item>
    <item>
      <title>What is redux?</title>
      <dc:creator>Jubayer Hossain</dc:creator>
      <pubDate>Fri, 25 Feb 2022 13:38:36 +0000</pubDate>
      <link>https://dev.to/coder71bd/what-is-redux-2j46</link>
      <guid>https://dev.to/coder71bd/what-is-redux-2j46</guid>
      <description>&lt;p&gt;According to the official documentation, &lt;strong&gt;Redux is a predictable state container for JS apps&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let's break down the definition they provided. We get 2 main keywords here. They are &lt;em&gt;&lt;strong&gt;'predictable'&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;'state container'&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;We will start with the term &lt;strong&gt;&lt;em&gt;'predictable'&lt;/em&gt;&lt;/strong&gt;. It means that we 'll have a complete idea of every single action and state of our application.&lt;/p&gt;

&lt;p&gt;The other term &lt;em&gt;&lt;strong&gt;'State Container'&lt;/strong&gt;&lt;/em&gt; refers to a container or store that will be provided by redux for storing our entire application state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XmA6snlo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ku9xz3eabvnp7oqmjbb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XmA6snlo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ku9xz3eabvnp7oqmjbb.png" alt="One way data flow" width="880" height="595"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://redux.js.org/tutorials/essentials/part-1-overview-concepts"&gt;Image source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's come to the point how redux maintains the &lt;strong&gt;&lt;em&gt;'predictable'&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;'state container'&lt;/em&gt;&lt;/strong&gt; terms. Actually redux provides some events called &lt;strong&gt;&lt;em&gt;'actions'&lt;/em&gt;&lt;/strong&gt; that can be used to update and manage our application state. But we have to follow certain patterns and rules of redux which will help us to predict our application state.&lt;/p&gt;

&lt;p&gt;Okay we have an initial idea of what redux is, but what problem does it solve?&lt;/p&gt;

&lt;p&gt;Let's imagine you are building a large scale React application. So there may be many components holding different states. If we want to pass this state from component to component we have to pass them as props again and again. And there is also the problem of 'lifting state up' arises. Redux solves this problem and gives us a centralized store to keep our state. We can easily access and modify our state by following some rules and patterns of redux.&lt;/p&gt;

&lt;p&gt;We have got a basic overview of what redux is and why it is useful. Let's look at how it works all together in an application.&lt;/p&gt;

&lt;p&gt;Firstly we have to create a store with the help of the root reducer function that will be provided by redux. There will be an initial state configured with the store. Our UI will be rendered based on the initial state. Now if we want to change something in our UI based on user interaction we have to modify the store. For performing this action redux provides a function called dispatch. Change in store forces all the parts to re-render that are using the previous state. Let's visualize this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zhrME2lu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1g9vna6tz8yikwhp7tq2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zhrME2lu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1g9vna6tz8yikwhp7tq2.gif" alt="Redux application data flow" width="880" height="660"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://redux.js.org/tutorials/essentials/part-1-overview-concepts"&gt;Image source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Redux also provides some cool libraries and tools like react-redux, redux-toolkit, redux dev tools. They have made our life easier.&lt;/p&gt;

&lt;p&gt;For exploring more you can check out their &lt;a href="https://redux.js.org/"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>redux</category>
    </item>
  </channel>
</rss>
