<?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 Aagya Sharma on Medium]]></title>
        <description><![CDATA[Stories by Aagya Sharma on Medium]]></description>
        <link>https://medium.com/@sharmaaagya7?source=rss-65e330990238------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OjvJi7p4RJpnK0y4RdhraQ.jpeg</url>
            <title>Stories by Aagya Sharma on Medium</title>
            <link>https://medium.com/@sharmaaagya7?source=rss-65e330990238------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 00:02:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sharmaaagya7/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[React State Management simplified with zustand]]></title>
            <link>https://medium.com/@sharmaaagya7/react-state-management-simplified-with-zustand-deef4544ffad?source=rss-65e330990238------2</link>
            <guid isPermaLink="false">https://medium.com/p/deef4544ffad</guid>
            <dc:creator><![CDATA[Aagya Sharma]]></dc:creator>
            <pubDate>Tue, 12 Sep 2023 14:55:31 GMT</pubDate>
            <atom:updated>2023-09-12T14:55:31.444Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is State in React?</strong></p><p>State in a react application is a piece of data that holds some information of a component which may change over the lifecycle of the component and controls the behaviour of the component. For instance the state in a component might store the information fetched from the backend or any information about the user that logs in</p><p><strong>State Management in React</strong></p><p>Before the evolution of redux, the state management in web applications was quite a challenge. The idea of redux completely changed the idea of managing state in react applications. There was now a single store that could manage the entire state of the application in a place. Later the complication with redux was solved with the introduction of redux toolkit.</p><p>Zustand introduced at is the best tool to use today for the state management</p><p><strong>Getting started with zustand</strong></p><p>Install Zustand</p><p>Run the following command for installing zustand</p><p><em>npm install zustand</em></p><p>or</p><p><em>yarn add zustand</em></p><p>Lets take an example of a counter component</p><pre>export const CounterComponent = () =&gt; {<br>    return (<br>        &lt;div&gt;<br>            &lt;button&gt;+&lt;/button&gt;<br>            {1}<br>            &lt;button&gt;-&lt;/button&gt;<br>        &lt;/div&gt;<br>    )<br>}</pre><p>Inside the counter component I have added two buttons for increasing and decreasing the counter value</p><p><strong>Connect the application with Zustand’s store</strong></p><p>Next we create a file and name it as store.js which will look like</p><pre>import {create} from &quot;zustand&quot;;<br><br>export const useCounterComponentStore = create(() =&gt; (<br>   {count: 1}<br>))  </pre><p>Also we can update the state using set() and now the store.js looks like:</p><pre>import {create} from &quot;zustand&quot;;<br><br>export const useCounterStore = create((set) =&gt; (<br>   {<br>       count: 1,<br>       increaseCount: () =&gt; set((state) =&gt; ({count: state.count + 1})),<br>       decreaseCount: () =&gt; set((state) =&gt; ({count: state.count - 1}))<br>   }<br>))</pre><p>The counter Component now can use the state value and functions as</p><pre>import {useCounterComponentStore} from &quot;./store&quot;;<br><br>export const CounterComponent = () =&gt; {<br>const counterNumber = useCounterComponentStore(state =&gt; state.count)<br>const increaseNumber = useCounterComponentStore(state =&gt; state.increaseCount)<br>const decreaseNumber = useCouterComponentStore(state=&gt;state.decreaseCount)<br>    return (<br>        &lt;div&gt;<br>            &lt;button onClick={increaseNumber}&gt;+&lt;/button&gt;<br>            {counterNumber}<br>            &lt;button onClick={decreaseNumber}&gt;-&lt;/button&gt;<br>        &lt;/div&gt;<br>    )<br>}</pre><p>and we are done simply by doing these steps .</p><p>So , Zustand has reduced the need to create reducers, actions, and dispatch functions just to change a very simple state saving a lot of time</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deef4544ffad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typescript over Javascript : why do developers prefer typescript?]]></title>
            <link>https://medium.com/@sharmaaagya7/typescript-over-javascript-why-do-developers-prefer-typescript-a61d5d98ff19?source=rss-65e330990238------2</link>
            <guid isPermaLink="false">https://medium.com/p/a61d5d98ff19</guid>
            <dc:creator><![CDATA[Aagya Sharma]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 14:17:42 GMT</pubDate>
            <atom:updated>2023-06-14T14:19:17.439Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Getting Started with TypeScript: A Beginner’s Guide</strong></p><p><strong>Typescript over Javascript : why do developers prefer typescript?</strong></p><p>Typescript is the statically-typed superset of JavaScript</p><p>One of the major benefits of TypeScript is strong typing. TypeScript requires us to declare the type of variables, which can help prevent type-related errors. This feature of typescript makes code easier to read, maintain, and debug, and can also help reduce the risk of security vulnerabilities.</p><p>The other advantage of using typescript is the code readability. The type inference in large projects make the code much more readable and maintainable.</p><pre>function add(a, b) {<br>  return a + b;<br>}<br>console.log(add(3,7));</pre><p>The above code is the function which adds two numbers in javascript. The same code when wriiten in typescript looks this way</p><pre>function add(a: number, b: number): number {<br>  return a + b;<br>}<br>console.log(add(3,7));</pre><p>The type inference makes the code more readable by defining what type of value the function accepts and what type of value it returns</p><p><strong>Data Types in Typescript</strong></p><ol><li><strong>Number</strong></li></ol><p>It is used to represent both integers and floating point numbers. Typescript has support for binary, octal, decimal and hexadecimal literals</p><pre>let x:number = 5;</pre><p>2. <strong>Boolean</strong></p><p>As in javascript, boolean data type in typescript represents a logical value indicating ‘true’ or ‘false’</p><pre>let completed:boolean = &#39;true&#39;</pre><p>3.<strong> String</strong></p><p>As in other languages, strings in typescript represents a sequence of characters enclosed in single quote or double quotes.</p><pre>let name:string = &quot;Jack&quot;</pre><p>4<strong>. Void</strong></p><p>Void represents the return type of a function that do not return any type of value.</p><pre>function alert():void{<br>  console.log(&quot;This is an alert message&quot;);<br>}</pre><p>5.<strong> Any</strong></p><p>The any data type is used to represent any javascript value. If a variable cannot be represented in any of the basic data types, then it can be declared using “any” data type. When we are using a third party api and we are unaware about the type of data, we can skip the type-checking at compile time using “any” type</p><pre>let value:any = &quot;HI&quot;;<br>let value:any = true</pre><p>6. <strong>Array</strong></p><p>The array data type allows to store a collection of values of same type in an ordered manner</p><pre>let numbers:number[] = [1,2,3,4];<br>let colors:string[] = [&quot;red&quot;,&quot;green&quot;]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a61d5d98ff19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Styling with React Native]]></title>
            <link>https://medium.com/@sharmaaagya7/styling-with-react-native-e8dded3c5004?source=rss-65e330990238------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8dded3c5004</guid>
            <dc:creator><![CDATA[Aagya Sharma]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 14:24:24 GMT</pubDate>
            <atom:updated>2023-06-13T14:24:24.963Z</atom:updated>
            <content:encoded><![CDATA[<p>React Native us an open source mobile application frameworks used by most native developers to build android and ios applications</p><p>Styling in React Native is done using javascript. All the core native components accept a prop named style</p><p>The style name and values usually match the css keyword and attributes. However, the names are written using camel casing. An example could be : we write background-color css property as backgroundColor.</p><p>The style prop that we define in react native is equivalent to the plain javascript object.</p><p>Applying inline styling to the components</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wGt9OQj9-aFnStSkOrMq1A.png" /></figure><p>But as the components grow, applying styling this way does not make the code look cleaner so we can use Stylesheet.create to define multiple styles of our application in a managed way</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*hY-EBhXK_irScUXWnuRzeQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8dded3c5004" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>