<?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: Ishan Tiwari</title>
    <description>The latest articles on DEV Community by Ishan Tiwari (@ishanpro).</description>
    <link>https://dev.to/ishanpro</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%2F677334%2Fd09e71c7-925e-40f7-9b3b-aa0e36580d5d.jpeg</url>
      <title>DEV Community: Ishan Tiwari</title>
      <link>https://dev.to/ishanpro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ishanpro"/>
    <language>en</language>
    <item>
      <title>The fastest way to develop your projects</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Tue, 09 Aug 2022 12:18:34 +0000</pubDate>
      <link>https://dev.to/ishanpro/the-fastest-way-to-develop-your-projects-3jcb</link>
      <guid>https://dev.to/ishanpro/the-fastest-way-to-develop-your-projects-3jcb</guid>
      <description>&lt;h2&gt;
  
  
  Who is this method for?
&lt;/h2&gt;

&lt;p&gt;I prefer to tell you that this method is designed best for people who call programming their side hustle however they are keen on converting from a hobbyist to a professional. Some examples can be a student in 10th grade immersed in studies who finds relief in code (me) or a person working at another boring job (according to him) and wants to code but his tight schedule buries him.&lt;/p&gt;

&lt;p&gt;All in All this method is for people who can't find enough time to code and are beginners in this field. Learning new frameworks and technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the method is?
&lt;/h2&gt;

&lt;p&gt;I recommend you not to code on your &lt;strong&gt;normal workday or school day&lt;/strong&gt;. i.e not to work on any development project. Instead plan your project what tech are you going to use -: what the homepage will look like, what will the models look like, what the routes will look like. Write these down in a notebook or diary and then learn the technologies you shall use in the project.&lt;/p&gt;

&lt;p&gt;On a weekend or holiday. Sit down take your notebook up and have 2-3 hours of uninterrupted code time. Write down again what you did, how did it go, what you are weak at, how can you solve these problems, what else do you need to work at.&lt;/p&gt;

&lt;p&gt;This way you will not spend much time actually programming, but a whole lot of time in thinking about code. You can solve entire bugs, without touching your code in your head the next 6 days. You can take important decisions without a monitor in front of you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why should this work?
&lt;/h2&gt;

&lt;p&gt;This should work because, it's not writing code which is hard it is planning that drives people crazy. This is will force you to spend a whole lot of time at planning and learning and then brutally applying your learning at a single go. This is time efficient as well. Writing your thoughts takes no more than about 20 minutes. You can do this the time you wake up or the time you retire to bed.&lt;/p&gt;

&lt;p&gt;Also, writing has miraculous powers, by actually writing what you want to do helps you accomplish your goals. It also helps to spark off a chain reaction of creative thoughts which can change the direction of your upcoming project for good entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I personally use this method all the time. I maintain a checklist of things to do, and set a deadline. On long holidays like summer vacations. I code everyday while planning. Also this method will help you escape the tutorial hell. Just read a tutorial and then start coding on your own project obtaining help from the tutorial, (not following along).&lt;/p&gt;

&lt;p&gt;It is up to you at the end of the day. If you feel the urge to code everyday. It's all up to you.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>React Tutorial Part - 3 -&gt; Getting real</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Thu, 28 Jul 2022 14:44:41 +0000</pubDate>
      <link>https://dev.to/ishanpro/react-tutorial-part-3-getting-real-336j</link>
      <guid>https://dev.to/ishanpro/react-tutorial-part-3-getting-real-336j</guid>
      <description>&lt;p&gt;In the last post I told you about user interactions in react and I am sure you must have tried some dummy apps (If you haven't you can just do it now). That is you must get a feel for it. You can create a UI with a menu and icon for opening and closing, you can count the no. of times a user clicked a button and all, but now that you have played with it, it is time to get real with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real World Apps
&lt;/h2&gt;

&lt;p&gt;Let me first explain what I mean by real world. These are apps someone (a real person) would use. It must offer some functionality to him. Some examples are: a chat app, a search engine and  a social media app (although social media is waste of time). &lt;/p&gt;

&lt;p&gt;Real world apps must look good then feel good and finally do little good. If you are on your way to create one you can not do so just with user interactivity, you need a lot of different things and react provides them the right way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The things that react provides you are&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Components - Break down your apps into easier to code components&lt;/li&gt;
&lt;li&gt;Context - Change data across multiple components&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is just it, you've just got two things to handle: Components that is the UI and structure of your app and the data for your app. React has a lot of libraries to support these two further, you may / mayn't use the standards; you can go out of the box and use completely different libraries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A few libraries for the UI are&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MaterialUI&lt;/li&gt;
&lt;li&gt;Tailwindcss&lt;/li&gt;
&lt;li&gt;React-bootstrap&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;** A few libraries for managing your data or state are **&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Redux-toolkit&lt;/li&gt;
&lt;li&gt;Recoil&lt;/li&gt;
&lt;li&gt;Rematch&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Redux-toolkit is the top choice here and I recommend it, but you need not believe me, so go, try out the new ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else do you need to know
&lt;/h2&gt;

&lt;p&gt;You need to know about some other hooks in react. Some are more important than others, and have their own use cases.&lt;/p&gt;

&lt;p&gt;You can view them in the &lt;a href="https://reactjs.org/docs/hooks-reference.html"&gt;documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is all there is to it. You can build a real world app from scratch using react. The only thing you need to worry about is where to store your data in the cloud. There are several answers to that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Places to have your data on&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;FaunaDB - A cloud database&lt;/li&gt;
&lt;li&gt;Supabase - A firebase alternative with user auth and more.&lt;/li&gt;
&lt;li&gt;Aws Amplify&lt;/li&gt;
&lt;li&gt;Firebase&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are countless others waiting for a search. I recommend supabase but again you need not count on me, use whatever you want.&lt;/p&gt;

&lt;p&gt;All that is remaining is to get your data from the backend (where your data is ) to the frontend (where the user is) and you can do so, while querying your data. There are a few libraries for that as well. They will cache the data, help in mutations and much more. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Libraries for building the bridge&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;RTK query&lt;/li&gt;
&lt;li&gt;React query&lt;/li&gt;
&lt;li&gt;Apollo&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I like RTK query because it comes in with Redux Toolkit all but again as I have said go experiment with a few.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The most important thing here&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The thing people don't understand is it seems easy on paper and pen, but if you haven't written such programs before ( or even if you have) building such a thing is a lot of code, a hell lot of code for some people. If you don't practice clean coding and write spaghetti on your pc. It will be overwhelming for you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, what do you want to do is keep a cool mind and just split out your code as much as possible write comments see other's code and learn from it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The new path
&lt;/h2&gt;

&lt;p&gt;It is the third blog in the series on day 3 and we are already getting real. In the next couple of blogs we will create a todo app with user authentication. The stack will include&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React (of course,)&lt;/li&gt;
&lt;li&gt;Redux-toolkit (for the data and bridge)&lt;/li&gt;
&lt;li&gt;Supabase (for the backend)&lt;/li&gt;
&lt;li&gt;tailwind (for the beauty)&lt;/li&gt;
&lt;li&gt;Codesandbox (for the code editor)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can choose whatever code-editor you want but online code editors are just a lot more hassle free and straight up on point. &lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for reading and please share your opinion with me
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://twitter.com/IshanTi29496052"&gt;Follow me on twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>React Tutorial For beginners - Part 2 -&gt; Getting reactive</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Wed, 27 Jul 2022 14:39:49 +0000</pubDate>
      <link>https://dev.to/ishanpro/react-tutorial-for-beginners-part-2-getting-reactive-2m70</link>
      <guid>https://dev.to/ishanpro/react-tutorial-for-beginners-part-2-getting-reactive-2m70</guid>
      <description>&lt;p&gt;In the previous post we saw how jsx and css work with react. It is enough to create nice html static html pages, but now we shall start doing something more dynamic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Static vs Dynamic
&lt;/h2&gt;

&lt;p&gt;Static sites are sites that have some content that doesn't depend on a data layer or a database. Games can be static they can use your localstorage as a database to store their data within your browser. It is fine enough for small apps but if you're the next Jeff Bezos consider a dynamic option to let users interact from different machines to your website.&lt;/p&gt;

&lt;h3&gt;
  
  
  How React embraces dynamicness
&lt;/h3&gt;

&lt;p&gt;React is a library built on top of javascript. So, you can do basically anything javascript can do over there. You can send requests to a server get the data throw it off the page and do much more. We will do some of the action in the later parts of this series.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Key takeaway here is that react can be a lot more dynamic than just dull html and css, but here what we want is user interaction. The user submits a form the application processes it and shows some output to the user a very basic app you can say.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  React Component Lifecycle
&lt;/h2&gt;

&lt;p&gt;As I told earlier that the jsx you just saw was the actual javascript code which will be compiled by babel to produce functions out of nowhere. These functions create React components you can use them instead of jsx (if you are a jerk) or just let compilers do their thing. &lt;/p&gt;

&lt;p&gt;What happens after that is when you visit a website the app component is mounted on the page just as we saw earlier then it does the user interacts with that in the web page. &lt;em&gt;Let's say that he enters a form and we want to handle that in react what do we do then. All we have to do is process that our way and re-render the component with the new data?&lt;/em&gt; ( Cause if we don't re-render the page will look the same as before)&lt;/p&gt;

&lt;p&gt;Of course there is still a lot of technicality but the above is just enough for starters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing State
&lt;/h2&gt;

&lt;p&gt;In computer terminology the state is all the data a certain process (app) requires for functioning. So, if you have a app that takes in a users name say &lt;code&gt;x&lt;/code&gt; and prints hi &lt;code&gt;x&lt;/code&gt;. The only state for the app is the user's name.&lt;/p&gt;

&lt;p&gt;In React state can work with the useState hook (React is actually had class based views but you can use simple functions and just "hook" in with hooks! )&lt;/p&gt;

&lt;h2&gt;
  
  
  Functioning demo
&lt;/h2&gt;

&lt;p&gt;Open up codesandbox to code Along!&lt;/p&gt;

&lt;p&gt;First we need to import React and useState so at the top do&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usestate accepts a default value for your state and returns you two things&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A variable with the value of the state&lt;/li&gt;
&lt;li&gt;A function with which if you change the value of the state the component re-renders automatically.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, you don't have to worry just use variables and edit their values using useState. forget about re-renders.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There are certain rules of hooks such as &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You can't use one inside a conditional block&lt;/li&gt;
&lt;li&gt;They must be at the top of a react component function.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;The syntax for a useState is this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;defaultvalue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setValue&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;defaultvalue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and use setValue like this. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;setValue(() =&amp;gt; {return somevalue})&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Yes, takes a function that returns the value of the new state.&lt;/p&gt;

&lt;p&gt;you can also have the previous value and do something to it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;setValue((prevValue) =&amp;gt; {prevValue + 1})&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Events
&lt;/h2&gt;

&lt;p&gt;One final thing we need to know about user interactivity is events. Events are when a user does something so great that it changes the face of the app.&lt;/p&gt;

&lt;p&gt;You may be familiar with the events in html. Like &lt;code&gt;onclick()&lt;/code&gt; &lt;code&gt;onsubmit()&lt;/code&gt; &lt;code&gt;onmouseover()&lt;/code&gt; events in react are similar you can use them to set different things you can go to codesandbox and playaround.&lt;/p&gt;

&lt;p&gt;Events in react can reference a function. So, that when they will occur they will execute the function.&lt;/p&gt;

&lt;p&gt;You can do this like &lt;/p&gt;

&lt;p&gt;&lt;code&gt;onClick={handleClick}&lt;/code&gt; where handle Click is a defined function. Execute the following code to see how to toggle a div.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./styles.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;defaultvalue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setToggle&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;defaultvalue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;setToggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevstate&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;prevstate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;toggle&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Toggle&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pay heed to the line &lt;code&gt;&amp;lt;button onClick={handleClick}&amp;gt;Toggle&amp;lt;/button&amp;gt;&lt;/code&gt;. It is saying that whenever the button is clicked execute the mentioned function. What the function does is says whatever the prevstate is reverse it (! is the not operator is converts true to not true and false to not false). Then when the component re-renders the jsx says that if toggle is true display hello. That is why this code works the way it does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exercise
&lt;/h2&gt;

&lt;p&gt;I want you to create a component where the user gives his name and you greet him. (HINT - use the onChange event with an input). You can google if you get caught up. ( That is the spirit of programming. :)&lt;/p&gt;

&lt;p&gt;When you are done you can view this &lt;a href="https://gist.github.com/Ishan-pro/f584ef5f0b7726b6b8f3eda7e085051f"&gt;gist&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>React beginners tutorial Part -1 Playing</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Tue, 26 Jul 2022 14:06:00 +0000</pubDate>
      <link>https://dev.to/ishanpro/react-beginners-tutorial-part-1-playing-1gpc</link>
      <guid>https://dev.to/ishanpro/react-beginners-tutorial-part-1-playing-1gpc</guid>
      <description>&lt;p&gt;React is one of the most popular technologies in web development. Many of the world's best firms use it. This is post is for for the beginners in the field of web development who are foreign to this library.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is React? why react?
&lt;/h2&gt;

&lt;p&gt;React is frontend library which you can use to create interactive user interfaces. It can help you create apps where users integration is necessary. It is lightweight and cost effective as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting up and ahead
&lt;/h2&gt;

&lt;p&gt;To get started with react you first need a quick setup tool. A tool that will provide you with essential config for your react app. You can pick between many different such tools but the two most popular once are.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create-react-app -&amp;gt; The official and slow&lt;/li&gt;
&lt;li&gt;vite -&amp;gt; the unofficial and fast&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even more beginner friendly are online code editors such as &lt;a href="//stackblitz.com"&gt;stackblitz&lt;/a&gt;, &lt;a href="//codesandbox.io"&gt;codesandbox&lt;/a&gt; and others.&lt;/p&gt;

&lt;p&gt;I prefer codesandbox here, you can signup and start doodling around to get a feel of it.&lt;/p&gt;

&lt;p&gt;When you start a new react template you will see something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F58z6kj3qill9j6i98976.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F58z6kj3qill9j6i98976.png" alt="React Template as on codesandbox"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The file structure looks like this&lt;/p&gt;

&lt;p&gt;|-public&lt;br&gt;
|----index.html&lt;br&gt;
|-src&lt;br&gt;
|----App.js&lt;br&gt;
|----index.js&lt;br&gt;
|----styles.css&lt;br&gt;
|-package.json&lt;/p&gt;

&lt;p&gt;The public contains things publicly accessible as you can see the function visible gets exported, then the index.js imports it and plunges it into a div. All the app in a single div!!&lt;/p&gt;

&lt;p&gt;So, src (short for source ) is where the actual magic happens. All your stylesheets, code and actual stuff&lt;/p&gt;
&lt;h1&gt;
  
  
  Doodling
&lt;/h1&gt;

&lt;p&gt;As you can see there is something like html over the function the function is actually returning html or more precisely jsx.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jsx&lt;/strong&gt; or  Javascript XML (something like Javscript markup) is actual javascript code that you write but with the help of babel it is transformed into actual javascript (the one you see in static files. You can have dynamic properties and a lot of other superpowers in there. Try changing the code in the App function to this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi alex&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Start&lt;/span&gt; &lt;span class="nx"&gt;editing&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;see&lt;/span&gt; &lt;span class="nx"&gt;some&lt;/span&gt; &lt;span class="nx"&gt;magic&lt;/span&gt; &lt;span class="nx"&gt;happen&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;yes you can actually just plunge values in there. Just open up curly brackets and throw the stuff in it.&lt;/p&gt;

&lt;p&gt;Moreover you can assign jsx as values to a variable. Come on do something with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Styling up
&lt;/h2&gt;

&lt;p&gt;You can give your elements a className (not class because it is a reserved keyword in javascript).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi alex&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;boring&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Start&lt;/span&gt; &lt;span class="nx"&gt;editing&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;see&lt;/span&gt; &lt;span class="nx"&gt;some&lt;/span&gt; &lt;span class="nx"&gt;magic&lt;/span&gt; &lt;span class="nx"&gt;happen&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;give boring a style in styles.css You can see that it is imported on top; that is just it! Import stylesheets. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;That was all for this post, read the second part to get a feel of the dynamicness with user interaction. Till then keep playing&lt;/p&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Handle Relationships with Django</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Mon, 25 Jul 2022 14:28:00 +0000</pubDate>
      <link>https://dev.to/ishanpro/how-to-handle-relationships-with-django-3gii</link>
      <guid>https://dev.to/ishanpro/how-to-handle-relationships-with-django-3gii</guid>
      <description>&lt;p&gt;Relationships become really tricky if you have a data managing backend with scores of data to handle with interconnections. This post tends to remove that jargon from your head.&lt;/p&gt;

&lt;p&gt;There are a lot of ways to do handle a thing in django. One is the opinionated way and other ways are potholes to look our for. So, we will discuss the use cases for using these relationships as well. Let's go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foreign keys and reverse accessors.
&lt;/h2&gt;

&lt;p&gt;If you must have seen a error during this type of code in Django.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;sender&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="n"&gt;receiver&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The error should say that, "Reverse accessor for 'Post.sender' clashes with reverse accessor for 'Post.receiver'."&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The thing is that django does not know how to access a users created posts(i.e the posts they are a sender of) and how to access their received posts (i.e the posts they are a receiver of).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To solve this confusion it is best to add a related_name argument. This let's you access a users received and sent posts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

      &lt;span class="n"&gt;sender&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'sentposts'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="n"&gt;receiver&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'receivedposts'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way you can access the sent and received posts via&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;alan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pk&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#Got the user
&lt;/span&gt;&lt;span class="n"&gt;posts_sent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;alan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sentposts&lt;/span&gt; &lt;span class="c1"&gt;#Got the posts!!
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://docs.djangoproject.com/en/4.0/topics/db/queries/#backwards-related-objects"&gt;more about that here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One to One relationships and illegal accounts
&lt;/h2&gt;

&lt;p&gt;Suppose you have a nice twitter like app you want add more functionality to the user perhaps give him his own profile picture a bio and all that you want to have a profile for him. So you do this -:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Profile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"profile"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="n"&gt;bio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything just looks fine here, but this is a big mistake.&lt;br&gt;
This mistake marks the difference between all these joins.&lt;br&gt;
Here, you not only want a Profile to be associated with a user but a unique user. Here, at least theoretically a user can have another Profile which is just as much his. You can stop that in the Frontend but what's the point if you can stop that in the backend. For a user to have a profile you can do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Profile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OneToOneField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"profile"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="n"&gt;bio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This saves your time your brain and your app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.djangoproject.com/en/4.0/topics/db/examples/one_to_one/"&gt;More about this here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Many to Many Fields and Technical Jargon
&lt;/h2&gt;

&lt;p&gt;Suppose you want a book library app. A book can be written by many authors and an author can also write many books. One To One relationship won't at all work, so will Foreign Key because after all it is just a property like a post can have a single sender and a receiver that's clear what many people do is have an intermediary like this -:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author_list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="n"&gt;Author1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"author1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="n"&gt;Author2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"author2"&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Author_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see this method can just accommodate a few authors and what do you do if a book has just one? Maybe set a few things to a null able value and then try. This method can is vulnerable to a lot of scale related issues. Instead just user the Many To Many relationship.&lt;/p&gt;

&lt;p&gt;All that is different between this and Foreign Key is that Foreign stores one value as column in your database and this stores a whole list of them. Think of it as a list of users who have written their masterpiece.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ManyToMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"books"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://docs.djangoproject.com/en/4.0/topics/db/examples/many_to_many/"&gt;More information on that here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hope you enjoyed reading the post. Many many happy wishes for your relationship with django.&lt;/p&gt;

&lt;p&gt;Cover Image by &lt;a href="https://pixabay.com/users/takmeomeo-375120/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=437968"&gt;Tú Anh&lt;/a&gt; from &lt;a href="https://pixabay.com/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=437968"&gt;Pixabay&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>webdev</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why ditched Windows for Linux</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Sun, 15 Aug 2021 08:17:51 +0000</pubDate>
      <link>https://dev.to/ishanpro/why-ditched-windows-for-linux-1og3</link>
      <guid>https://dev.to/ishanpro/why-ditched-windows-for-linux-1og3</guid>
      <description>&lt;h2&gt;
  
  
  What Is Linux
&lt;/h2&gt;

&lt;p&gt;When it comes to this topic there are two kinds of people. People who react What is Linux even? and the People who say like Yeah I know Linux and I have it on my pc.&lt;/p&gt;

&lt;p&gt;Well, Linux is not a single operating system but a whole family of them. A man named Linus Torvalds created the Linux Kernel (A program made to manage all the devices connected to a system) and made it available open source and that was the starting point of Linux. From then People started adding their own code on top of it to create various operating systems.&lt;/p&gt;

&lt;p&gt;There are 100s no 1000s of operating systems under the linux family of operating systems a whole new you have probably not discovered.&lt;/p&gt;

&lt;p&gt;These operating systems do again upload things open source and then more and more operating systems use their existing code to create new operating systems.&lt;/p&gt;

&lt;p&gt;Some of the Jewels of Linux's Crowns are. ArchLinux, Fedora, Ubuntu, Debian and Linux Mint. Most of the operating systems are used to manage servers, but a few people use it as their daily operating system.&lt;/p&gt;

&lt;p&gt;The one which I use is Linux Mint which is based on Ubuntu and Ubuntu itself based on Debian and Debian just sits on top of the Linux Kernel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Linux
&lt;/h2&gt;

&lt;p&gt;Ok, we just discussed that Linux exists, but its mere existence will not mean that you have to use it over Windows (In this article I am comparing Windows and Linux keeping Macos out of the arena because I never owned a mac). It should have features that make it better than the computer gaint Windows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Speed
&lt;/h3&gt;

&lt;p&gt;The problem of having a 4gb ram laptop increase when you program in it. I used my laptop to code and it just used to break up every now and then.&lt;br&gt;
I was fed up of this problem and decided to do a quick google search about the fastest operating system ( I knew linux existed but I never actually tried it). The answer was Linux Mint and after the switch I got relieved from the problem of repetitive hangs. It stil hangs but not every now and then but occasionaly or if I be honest weekly&lt;/p&gt;

&lt;h3&gt;
  
  
  Simplicity
&lt;/h3&gt;

&lt;p&gt;Do you own a Windows laptop then you know the pain of updating it now and then like every month or so. A automatic Candy Crush install when you buy your PC. All this won't happen in Linux. They tell you want is happening on your pc. Just the apps you want and no hassle to install updates foricbly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reviving Old Systems
&lt;/h3&gt;

&lt;p&gt;If I own a windows laptop then the biggest problem for me is that if it is not that high-end then the operating system will take repetitve hiccups. Linux on the other hand can be run on a 2gb ram laptop as well. Your daddy's old PC has got no need to be upgraded use linux and save money.&lt;/p&gt;

&lt;h3&gt;
  
  
  Free
&lt;/h3&gt;

&lt;p&gt;This is the most striking feature of Linux. It has better features than Windows but is still free. That is why Linux laptops are cheaper than Windows laptops.&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Should you use a css library</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Sun, 15 Aug 2021 07:48:40 +0000</pubDate>
      <link>https://dev.to/ishanpro/should-you-use-a-css-library-584e</link>
      <guid>https://dev.to/ishanpro/should-you-use-a-css-library-584e</guid>
      <description>&lt;p&gt;There are plenty of css libraries available out there like bootstrap, materialize, tailwind css, Material UI and a lot of them.&lt;/p&gt;

&lt;p&gt;But there is the big question should these libraries ever be used? &lt;/p&gt;

&lt;h2&gt;
  
  
  The pros of using a css library
&lt;/h2&gt;

&lt;p&gt;The biggest pro of using a css library is consistency. That is if you stick with one library for example bootstrap and learn it by heart then all of the websites you build will have the same layout and will follow a nice track&lt;/p&gt;

&lt;p&gt;Speed is another pro using a css library. If you use a css library you just have to write classes in your elements and then see them spinning to life. It saves you a lot of hardwork.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cons
&lt;/h2&gt;

&lt;p&gt;The biggest con for a css library is that you never ever have to touch css for some of those. So if you are a newbie in the world of Web Development then you'll never ever touch css and never learn it.&lt;/p&gt;

&lt;p&gt;The second con is a thing called flexibility. If you write all the css code inside your app then you leave your mark in every app you create, but if you use something like bootstrap it is their wish of how your application should behave. Like the navbar, the header, the footer, the headings and everything if you want to gain the control and work speedily as well you will have to learn what styles its component uses. So, that you don't encounter tricky bugs as a result of the conflict of their css and your css.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Provided the last two cons you should only use a css library when.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It is a project which you want to create fast.&lt;/li&gt;
&lt;li&gt;You are a css master and or the master of the library.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The other question well is. Is it profitable getting into learning the css library?&lt;br&gt;
Yes, it is they will give your projects speed and good looks.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>css</category>
    </item>
    <item>
      <title>An introduction to React's usestate hook</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Fri, 06 Aug 2021 02:26:57 +0000</pubDate>
      <link>https://dev.to/ishanpro/an-introduction-to-react-s-usestate-hook-243e</link>
      <guid>https://dev.to/ishanpro/an-introduction-to-react-s-usestate-hook-243e</guid>
      <description>&lt;p&gt;If you use React you must be knowing that there is a concept of state and props. You can add state to a class component very easily but for adding state in a  functional component you need to use the usestate hook.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a hook ?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is a quote from the official react documentation.&lt;/p&gt;

&lt;p&gt;Hooks basically allow you to use methods which you can use in classes to be used in functional components. Hooks have some rules as well which we will discuss later on.&lt;br&gt;
For now you just take way that hooks are utility functions which allow you to write the code that you can write in class components to be used in functional components.&lt;/p&gt;
&lt;h2&gt;
  
  
  The useState hook
&lt;/h2&gt;

&lt;p&gt;In the useState hook you just import a function and then call it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialCounter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hookhere&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialCounter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hookhere&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;)
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see the useState hook takes the initalCounter as a parameter.&lt;br&gt;
The output of this function will be a list with the the first item as the state itself and the second item will be function to change the state. So, we can use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment"&gt;object destructuring&lt;/a&gt;.&lt;br&gt;
Like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCounter&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialCounter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can use this counter in the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Manipulating the State
&lt;/h3&gt;

&lt;p&gt;You currently have a setState function you can use that to manipulate the state. It takes another function as a paramter and that function will be changing the state.&lt;/p&gt;

&lt;p&gt;This function can take in the prevstate as a paramete r however this is optional.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;setCounter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;prevstate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;prevstate&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see here in this code above, the setCounter function takes in another function and that another function returns a value which becomes the new state.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rules of hooks
&lt;/h3&gt;

&lt;p&gt;Hooks have a few rules as well such as.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You cannot call a hook conditionally&lt;/li&gt;
&lt;li&gt;Hooks must be called in the same order after every render.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is a codesandbox for a basic counter application using react hooks.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/react-counter-z9jbg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Font ligatures in Vscode</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Mon, 02 Aug 2021 07:57:56 +0000</pubDate>
      <link>https://dev.to/ishanpro/font-ligatures-in-vscode-gfd</link>
      <guid>https://dev.to/ishanpro/font-ligatures-in-vscode-gfd</guid>
      <description>&lt;p&gt;Ligatures are awesome and they produce very picturesque figures while coding, which makes them a bliss to use.&lt;br&gt;
Here is a guide on how to implement them in vscode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Download fira code
&lt;/h2&gt;

&lt;p&gt;Fira code is a font made exclusively for developers and supports ligatures.&lt;br&gt;
You can download that from google fonts &lt;a href="https://fonts.google.com/specimen/Fira+Code"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Update Vs Code's default font
&lt;/h2&gt;

&lt;p&gt;To do this open up visual studio code and go to settings then in the place of Font Family type down Fira Code.&lt;br&gt;
After this you will see fira code as your defualt font for coding. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Enable ligatures
&lt;/h2&gt;

&lt;p&gt;There is one last step you need to follow to enable ligatures.&lt;br&gt;
In visual studio hit Ctrl+Shift+P (Command instead of ctrl if you are on mac). Then hit open settings.json.&lt;br&gt;
This will open settings.json a file with all your configurations.&lt;br&gt;
locate editor.fontligatures and write true ahead of it. &lt;/p&gt;

&lt;p&gt;Enjoy and comment down if you like those ligatures.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>programming</category>
    </item>
    <item>
      <title>Django vs Mern Which one to choose?</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Sun, 01 Aug 2021 08:13:03 +0000</pubDate>
      <link>https://dev.to/ishanpro/django-vs-mern-which-one-to-choose-3j0n</link>
      <guid>https://dev.to/ishanpro/django-vs-mern-which-one-to-choose-3j0n</guid>
      <description>&lt;p&gt;Many people take a lot of time to think about which web framework to choose for their next website. Here is a guide to help you choose the one most suitable for your next project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Django
&lt;/h2&gt;

&lt;p&gt;If you want to create a good looking website fast and with ease go with django. In my opinion django is the best web framework you can choose for blogs, newsletters and other applications.&lt;br&gt;
People often call it the web framework with batteries included batteries for user authentication, models, emails, testing and a whole lot of them. I myself have built full fledged websites in django within days. If speed is all you want nothing is better than django.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mern
&lt;/h2&gt;

&lt;p&gt;Mern stands for MongoDB, Express, React and Node.&lt;br&gt;
If you want to build a perfectionist website like a social media app, a nice community website like the one you are reading this post in mern has got you covered.&lt;br&gt;
The best features of mern is that you can drop react and choose any framework like react native, flutter, angular or even build a desktop application with c++ and the backend won't even care.&lt;br&gt;
You can create multiple things like a website with react and a android and ios app with react native, but it would take slightly more time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;If you have to create a website like a blog application or a e commerce app FAST django should be your choice but if you aren't hurried and want to create a big application then mern should be your choice both slow and complicated.&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>node</category>
      <category>react</category>
    </item>
    <item>
      <title>Why should you use Redux</title>
      <dc:creator>Ishan Tiwari</dc:creator>
      <pubDate>Sat, 31 Jul 2021 04:58:03 +0000</pubDate>
      <link>https://dev.to/ishanpro/why-should-you-use-redux-4o33</link>
      <guid>https://dev.to/ishanpro/why-should-you-use-redux-4o33</guid>
      <description>&lt;p&gt;You may find react's state and props system useful but  here are some reasons for you to use redux instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  React seperates things
&lt;/h2&gt;

&lt;p&gt;React is made on the core fundamenatals of separation of concerns.&lt;br&gt;
React thinks that the Header component needs not know  what is going on in the footer. It should better mind its own business.&lt;br&gt;
That means if you are using react, and are currently in the header component you should not be knowing what is there in the footer. Well there are a few ways to know what is going on in the footer like event emitters and all those hectic stuff, but you should better use Redux&lt;/p&gt;

&lt;h2&gt;
  
  
  React is component based
&lt;/h2&gt;

&lt;p&gt;React manages things on a component level. If you are using react for say a blog application provided that each blog is a single component and it fetches some data from a backend api and displays it to the user. After the user has read the blog you want to show him some content related to the blog. You will again call some api and fetch the content in this blog. Let's say he clicks on some other blogs and the same thing happpens you would notice that the api is being called again and again, because the component is getting re rendered with updated values. &lt;br&gt;
You can deal with this code reuse if you had a large heap of data where everything is stored and take it out everytime the blog re-renders. That would do the same thing but consume less data.&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
