<?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: Coding is Love</title>
    <description>The latest articles on DEV Community by Coding is Love (@codingislove).</description>
    <link>https://dev.to/codingislove</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%2F62385%2F97a38bb7-3bc2-4c1b-9c9d-51b76e8510a5.jpg</url>
      <title>DEV Community: Coding is Love</title>
      <link>https://dev.to/codingislove</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codingislove"/>
    <language>en</language>
    <item>
      <title>Marvel’s Shang-Chi – What if he was a web developer? | Web Multiverse</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Wed, 09 Mar 2022 12:05:08 +0000</pubDate>
      <link>https://dev.to/codingislove/marvels-shang-chi-what-if-he-was-a-web-developer-web-multiverse-4321</link>
      <guid>https://dev.to/codingislove/marvels-shang-chi-what-if-he-was-a-web-developer-web-multiverse-4321</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/L4W5Ek7Ecmg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/shang-chi-web-developer/"&gt;Marvel’s Shang-Chi – What if he was a web developer? | Web Multiverse&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>humor</category>
      <category>javascript</category>
    </item>
    <item>
      <title>12 commonly used Javascript Array methods that you should know</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Tue, 08 Feb 2022 06:21:09 +0000</pubDate>
      <link>https://dev.to/codingislove/12-commonly-used-javascript-array-methods-that-you-should-know-4bn0</link>
      <guid>https://dev.to/codingislove/12-commonly-used-javascript-array-methods-that-you-should-know-4bn0</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/kzhROoVabsQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/common-js-array-methods/"&gt;12 commonly used Javascript Array methods that you should know&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codingtutorials</category>
      <category>coding</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Pushpa logo using HTML &amp; CSS #Pushpa #Thaggedele</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Sat, 05 Feb 2022 15:49:01 +0000</pubDate>
      <link>https://dev.to/codingislove/pushpa-logo-using-html-css-pushpa-thaggedele-43lf</link>
      <guid>https://dev.to/codingislove/pushpa-logo-using-html-css-pushpa-thaggedele-43lf</guid>
      <description>&lt;p&gt;I made this awesome Pushpa logo using HTML and CSS. I have used the power of CSS mask-image to give the logo a nice fingerprint texture as seen in the original movie.&lt;/p&gt;

&lt;p&gt;Don’t miss Allu Arjun’s dialogue at the end ![🤘]&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/1VSCvnWyZTQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/pushpa-logo-html-css/"&gt;Pushpa logo using HTML &amp;amp; CSS #Pushpa #Thaggedele&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>uischool</category>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>RoughNotation.js, A JavaScript library to create and animate annotations | Spotlight of the day</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Sat, 05 Feb 2022 15:46:15 +0000</pubDate>
      <link>https://dev.to/codingislove/roughnotationjs-a-javascript-library-to-create-and-animate-annotations-spotlight-of-the-day-1lmc</link>
      <guid>https://dev.to/codingislove/roughnotationjs-a-javascript-library-to-create-and-animate-annotations-spotlight-of-the-day-1lmc</guid>
      <description>&lt;p&gt;Rough Notation uses RoughJS to create a hand-drawn look and feel. Elements can be annotated in a number of different styles. Animation duration and delay can be configured, or just turned off.&lt;/p&gt;

&lt;p&gt;Rough Notation is 3.8kb in size when gzipped, and the code is available on GitHub.&lt;/p&gt;

&lt;p&gt;Reference links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RoughNotation Github – &lt;a href="https://github.com/rough-stuff/rough-notation"&gt;https://github.com/rough-stuff/rough-notation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;RoughNotation website – &lt;a href="https://roughnotation.com/"&gt;https://roughnotation.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/EN-WGLPD1-c"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/animated-annotations-javascript/"&gt;RoughNotation.js, A JavaScript library to create and animate annotations | Spotlight of the day&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devresources</category>
      <category>spotlightoftheday</category>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>Rythm.js, A javascript library that makes your page dance | Spotlight of the day series</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Wed, 02 Feb 2022 18:47:58 +0000</pubDate>
      <link>https://dev.to/codingislove/rythmjs-a-javascript-library-that-makes-your-page-dance-spotlight-of-the-day-series-gc6</link>
      <guid>https://dev.to/codingislove/rythmjs-a-javascript-library-that-makes-your-page-dance-spotlight-of-the-day-series-gc6</guid>
      <description>&lt;p&gt;A javascript library that makes your page dance.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/FlgdWiS1ltY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/rythm-js/"&gt;Rythm.js, A javascript library that makes your page dance | Spotlight of the day series&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>spotlightoftheday</category>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>I threw a confetti party on my website, Find out how! | Spotlight of the day series</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Mon, 31 Jan 2022 20:38:11 +0000</pubDate>
      <link>https://dev.to/codingislove/i-threw-a-confetti-party-on-my-website-find-out-how-spotlight-of-the-day-series-2n3a</link>
      <guid>https://dev.to/codingislove/i-threw-a-confetti-party-on-my-website-find-out-how-spotlight-of-the-day-series-2n3a</guid>
      <description>&lt;p&gt;Learn how to shoot confetti on your website using HTML canvas and javascript and make it snow!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Canvas-confetti : &lt;a href="https://github.com/catdad/canvas-confetti"&gt;https://github.com/catdad/canvas-confetti&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Code example : &lt;a href="https://codepen.io/Ranjithkumar10/pen/mdqeoVp"&gt;https://codepen.io/Ranjithkumar10/pen/mdqeoVp&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/P-8xgdFUPX8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>spotlightoftheday</category>
      <category>uischool</category>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>Convert text to realistic handwriting using Javascript</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Mon, 31 Jan 2022 20:18:33 +0000</pubDate>
      <link>https://dev.to/codingislove/convert-text-to-realistic-handwriting-using-javascript-hlb</link>
      <guid>https://dev.to/codingislove/convert-text-to-realistic-handwriting-using-javascript-hlb</guid>
      <description>&lt;p&gt;hello everyone welcome back to another episode of the spotlight of the day series. Today we have a library called &lt;a href="https://github.com/alias-rahil/handwritten.js"&gt;handwritten.js&lt;/a&gt; This is a library that helps us in converting text to realistic handwriting.&lt;/p&gt;

&lt;p&gt;let me show you an example first.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DMH7mN6j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/alias-rahil/handwritten.js/master/screenshots/lorem-ipsum.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DMH7mN6j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/alias-rahil/handwritten.js/master/screenshots/lorem-ipsum.jpeg" alt="" width="880" height="622"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is just text the text is converted into realistic-looking handwriting using the library. if someone sees this, they’ll think that is this actually written by someone by hand. it’s converted it perfectly like almost someone wrote it by hand.&lt;br&gt;&lt;br&gt;
You can use this library in multiple ways. you can use it using the cli, you can use it in node.js or you can use it in the browser as well. We’ll try to use it in node.js&lt;/p&gt;
&lt;h3&gt;
  
  
  Practical use case
&lt;/h3&gt;

&lt;p&gt;let’s say you want to fake your homework and you have some content online you can just copy the content and use this library to convert it into realistic handwriting and you can submit it.&lt;/p&gt;

&lt;p&gt;More details are in the full video &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uBgFxKnU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/13.1.0/72x72/1f447.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uBgFxKnU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/13.1.0/72x72/1f447.png" alt="👇" width="72" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/AhYO-QIhEc0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/convert-text-to-realistic-handwriting-using-javascript/"&gt;Convert text to realistic handwriting using Javascript&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codingtutorials</category>
      <category>spotlightoftheday</category>
      <category>coding</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Create cool typing animation in your website | Spotlight of the day series</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Sat, 29 Jan 2022 18:45:46 +0000</pubDate>
      <link>https://dev.to/codingislove/create-cool-typing-animation-in-your-website-spotlight-of-the-day-series-434a</link>
      <guid>https://dev.to/codingislove/create-cool-typing-animation-in-your-website-spotlight-of-the-day-series-434a</guid>
      <description>&lt;p&gt;Learn how to create a cool text animation that appears to be typed by a real user&lt;/p&gt;

&lt;h4&gt;
  
  
  Reference links
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Typed.js GitHub – &lt;a href="https://github.com/mattboldt/typed.js"&gt;https://github.com/mattboldt/typed.js&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Typed.js website – &lt;a href="https://mattboldt.com/demos/typed-js"&gt;https://mattboldt.com/demos/typed-js&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/vBCKGXicQMs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/create-cool-typing-animation-in-your-website-spotlight-of-the-day-series/"&gt;Create cool typing animation in your website | Spotlight of the day series&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devresources</category>
      <category>uischool</category>
      <category>coding</category>
      <category>css</category>
    </item>
    <item>
      <title>Text recognition in the browser using Tesseract.js | Spotlight of the day series</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Fri, 28 Jan 2022 20:41:55 +0000</pubDate>
      <link>https://dev.to/codingislove/text-recognition-in-the-browser-using-tesseractjs-spotlight-of-the-day-series-3clg</link>
      <guid>https://dev.to/codingislove/text-recognition-in-the-browser-using-tesseractjs-spotlight-of-the-day-series-3clg</guid>
      <description>&lt;p&gt;Learn how to do text recognition in the browser in a react app using &lt;a href="https://github.com/naptha/tesseract.js"&gt;tesseract.js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source code is available at &lt;a href="https://www.youtube.com/watch?v=MnaMqJH46Dw"&gt;Tesseract OCR React&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Watch the full tutorial below&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MnaMqJH46Dw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/text-recognition-in-the-browser-using-tesseract-js-spotlight-of-the-day-series/"&gt;Text recognition in the browser using Tesseract.js | Spotlight of the day series&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codingtutorials</category>
      <category>coding</category>
      <category>css</category>
      <category>html</category>
    </item>
    <item>
      <title>Automate Whatsapp using Javascript | Spotlight of the day</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Fri, 28 Jan 2022 08:16:12 +0000</pubDate>
      <link>https://dev.to/codingislove/automate-whatsapp-using-javascript-spotlight-of-the-day-61a</link>
      <guid>https://dev.to/codingislove/automate-whatsapp-using-javascript-spotlight-of-the-day-61a</guid>
      <description>&lt;p&gt;Learn how to automate whatsapp using Javascript (NodeJS) Ex: Automate sending messages/replying to messages, scheduling messages etc. A lot more can be automated!&lt;/p&gt;

&lt;p&gt;Spotlight of the day is a library called &lt;a href="https://wwebjs.dev/"&gt;whatsapp-web.js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Checkout &lt;a href="https://github.com/pedroslopez/whatsapp-web.js"&gt;whatsapp-web.js github&lt;/a&gt; repo and watch the full tutorial video below&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iovH8bwSCWY"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/automate-whatsapp-using-javascript-spotlight-of-the-day/"&gt;Automate Whatsapp using Javascript | Spotlight of the day&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codingtutorials</category>
      <category>spotlightoftheday</category>
      <category>automation</category>
      <category>coding</category>
    </item>
    <item>
      <title>How to setup Mobx with react context</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Mon, 29 Jun 2020 16:40:40 +0000</pubDate>
      <link>https://dev.to/codingislove/how-to-setup-mobx-with-react-context-49jh</link>
      <guid>https://dev.to/codingislove/how-to-setup-mobx-with-react-context-49jh</guid>
      <description>&lt;p&gt;&lt;a href="https://mobx.js.org/README.html"&gt;Mobx&lt;/a&gt; is a &lt;a href="https://codingislove.com/tag/javascript/"&gt;Javascript&lt;/a&gt; library for state management. It is not specific to react but works great with react. Let’s see how to setup Mobx with react and react context specifically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QA1bAPGS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/mox-react-context-demo-1024x500.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QA1bAPGS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/mox-react-context-demo-1024x500.png" alt="Mobx react context example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is react context?
&lt;/h2&gt;

&lt;p&gt;Context provides a way to pass data through the component tree without having to pass props down manually at every level.&lt;/p&gt;

&lt;p&gt;In simple words, React context is used to store some data at one place and use it all over the app. Components also re-render every time the data in context is modified. If we don’t use context then we would be passing data manually using props.&lt;/p&gt;

&lt;p&gt;Technically, Mobx and other state management libraries also do the same thing but with more features&lt;/p&gt;

&lt;h2&gt;
  
  
  Why use Mobx with react context?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;It is not mandatory to use react context with Mobx but it is recommended now officially on the mobx-react website.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Earlier, Mobx had an &lt;code&gt;Provider/inject&lt;/code&gt; pattern. There’s one &lt;code&gt;Provider&lt;/code&gt; in the root, &lt;code&gt;inject&lt;/code&gt; is used to inject the mobx store to any component and &lt;code&gt;observer&lt;/code&gt; is used to make a component re-render whenever the store is modified.&lt;/p&gt;

&lt;p&gt;This &lt;code&gt;Provider/inject&lt;/code&gt; works great but it is heavily opinionated. &lt;strong&gt;&lt;code&gt;Provider/inject&lt;/code&gt; pattern still works with mobx-react 6.x but it is considered as obsolete now&lt;/strong&gt;. You can read more about it here – &lt;a href="https://mobx-react.js.org/recipes-inject"&gt;Why inject pattern is obsolete&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, It is better to use Mobx with react context starting from mobx-react 6.x but the problem is the &lt;a href="https://mobx-react.js.org/recipes-context"&gt;official docs&lt;/a&gt; on setting up Mobx with react context is quite confusing.&lt;/p&gt;

&lt;p&gt;If you read the docs then there will be many questions in your mind. Like &lt;strong&gt;how to use Mobx react context with class components&lt;/strong&gt; , how to use Mobx react context with functional components, how to observe for changes on class components and functional components.&lt;/p&gt;

&lt;p&gt;Official docs only mention how to use context and mobx with hooks but there’s nothing related to class components. I’m pretty sure that majority of the react developers are still using class components even if they have started using hooks.&lt;/p&gt;

&lt;p&gt;So I’m writing this detailed guide on how to setup Mobx with react context to clarify any such questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to setup Mobx with &lt;a href="https://dev.to/codingislove/building-youtube-ui-in-30-mins--react-native-tutorial-38mo-temp-slug-565632"&gt;react native&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;This exact setup works with react native as well. Just skip the react specific sections. I’m assuming that you have a basic react native app generated using react-native-cli. Everything else remains the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic react app
&lt;/h2&gt;

&lt;p&gt;I’m starting from scratch just to be clear but if you already have a react app setup then that is completely fine and you can skip this section.&lt;/p&gt;

&lt;p&gt;Create a basic react app using &lt;code&gt;create-react-app&lt;/code&gt; by running the following command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app my-app
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You have a basic app now. You can &lt;code&gt;cd&lt;/code&gt; into the newly created app and run it using.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd my-app &amp;amp;&amp;amp; yarn start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you go to &lt;code&gt;http://localhost:3000/&lt;/code&gt; then you can see a basic react app running which looks like this :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5f-DrTAq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/mox-react-context-app-1024x500.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5f-DrTAq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/mox-react-context-app-1024x500.png" alt="setup mobx with react context"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to eject from create-react-app for enabling Mobx decorators syntax. Eject using :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn eject
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Mobx and Mobx-react
&lt;/h2&gt;

&lt;p&gt;Mobx is the main library and mobx-react has the mobx binding for react. Install both Mobx and Mobx-react using the following command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add mobx mobx-react
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you had already setup react app and Mobx then &lt;strong&gt;Make sure that mobx-react is 6.x or higher&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Enable Mobx decorators syntax
&lt;/h2&gt;

&lt;p&gt;You can use Mobx without the decorators syntax as well but using decorators simplifies the code so let’s enable it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enable decorators for react app
&lt;/h2&gt;

&lt;p&gt;Make sure that you have ejected from create-react-app as mentioned above using &lt;code&gt;yarn eject&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install the babel plugins for decorators using :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add --dev @babel/plugin-proposal-decorators @babel/plugin-proposal-class-properties
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Go to package.json file and replace the babel section with the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"babel": {
    "presets": [
      "react-app"
    ],
    "plugins": [
      ["@babel/plugin-proposal-decorators", { "legacy": true }],
      ["@babel/plugin-proposal-class-properties", { "loose": true }]
    ]
  }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Enable decorators for react-native
&lt;/h2&gt;

&lt;p&gt;Install the babel plugins for decorators using :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add --dev @babel/plugin-proposal-decorators @babel/plugin-proposal-class-properties
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Go to &lt;code&gt;babel.config.js&lt;/code&gt; and paste this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    ['@babel/plugin-proposal-decorators', { legacy: true }],
    ['@babel/plugin-proposal-class-properties', { loose: true }],
  ],
};
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Decorator syntax is enabled now!&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup a basic Mobx store
&lt;/h2&gt;

&lt;p&gt;go to src folder in react app, create a folder named &lt;code&gt;services&lt;/code&gt; and create a file named &lt;code&gt;store.js&lt;/code&gt; inside the services folder. You create this file anywhere in the project as per your preference. I’m just showing an example to organize it properly.&lt;/p&gt;

&lt;p&gt;Go to newly created &lt;code&gt;store.js&lt;/code&gt; file and paste the following code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { action, observable } from "mobx";

/* Store start */
export default class Store {
  @observable title = "Coding is Love";

  @observable user = {
    userId: 1,
    name: "Ranjith kumar V",
    website: "https://codingislove.com",
    email: "ranjith@codingislove.com",
  };

  @action
  setUser(user) {
    this.user = user;
  }

  @action
  updateUser(data) {
    this.user = { ...this.user, ...data };
  }

  @action
  clearUser() {
    this.user = undefined;
  }

  @action
  setTitle(title) {
    this.title = title;
  }
}
/* Store end */

/* Store helpers */
const StoreContext = React.createContext();

export const StoreProvider = ({ children, store }) =&amp;gt; {
  return (
    &amp;lt;StoreContext.Provider value={store}&amp;gt;{children}&amp;lt;/StoreContext.Provider&amp;gt;
  );
};

/* Hook to use store in any functional component */
export const useStore = () =&amp;gt; React.useContext(StoreContext);

/* HOC to inject store to any functional or class component */
export const withStore = (Component) =&amp;gt; (props) =&amp;gt; {
  return &amp;lt;Component {...props} store={useStore()} /&amp;gt;;
};
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Store explanation
&lt;/h2&gt;

&lt;p&gt;Its a very simple store with a user object to store user data, a title string, a few functions to modify the user and title. &lt;strong&gt;&lt;code&gt;@observable&lt;/code&gt; is used to tell mobx to re-render components whenever an observable property is modified.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;@action&lt;/code&gt; is a function that is used for modifying observables. Running an &lt;code&gt;@actions&lt;/code&gt; also triggers &lt;code&gt;autoRun&lt;/code&gt; functions if you have set up any of them.&lt;/p&gt;

&lt;p&gt;useStore is our custom hook to use mobx store in any functional component&lt;/p&gt;

&lt;p&gt;withStore is a custom HOC (Higer order component) to use mobx store in any class component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mobx Provider setup
&lt;/h2&gt;

&lt;p&gt;Go to your main file. &lt;code&gt;App.js&lt;/code&gt; in case of create-react-app and paste this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import Home from "./screens/Home";
import Store, { StoreProvider } from "./services/store";

const store = new Store();
/* Create a new store */

function App() {
  return (
    &amp;lt;StoreProvider store={store}&amp;gt;
      &amp;lt;Home /&amp;gt;
    &amp;lt;/StoreProvider&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We are using &lt;code&gt;StoreProvider&lt;/code&gt; in the root and a single component named Home&lt;/p&gt;

&lt;p&gt;Create a folder called &lt;code&gt;screens&lt;/code&gt; and create a file named &lt;code&gt;Home.js&lt;/code&gt; inside the folder and paste this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from "react";
import logo from "../logo.svg";
import "../App.css";
import { observer } from "mobx-react";
import { withStore } from "../services/store";

@withStore
@observer
class Home extends Component {
  toggleTitle = () =&amp;gt; {
    const { store } = this.props;
    if (store.title === "Coding is Love") {
      store.setTitle("Mobx React Context");
    } else {
      store.setTitle("Coding is Love");
    }
  };

  render() {
    const { store } = this.props;
    return (
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;header className="App-header"&amp;gt;
          &amp;lt;img src={logo} className="App-logo" alt="logo" /&amp;gt;
          &amp;lt;a
            className="App-link"
            href="https://codingislove.com"
            target="_blank"
            rel="noopener noreferrer"
          &amp;gt;
            {store.title}
          &amp;lt;/a&amp;gt;
          &amp;lt;button onClick={this.toggleTitle} style={{ margin: 20 }}&amp;gt;
            Toggle title
          &amp;lt;/button&amp;gt;
        &amp;lt;/header&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}

export default Home;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We are using @withStore HOC that was created in &lt;code&gt;store.js&lt;/code&gt; to use our store. @observer is used to re-render the component whenever store is modified.&lt;/p&gt;

&lt;p&gt;This is an example of &lt;strong&gt;How to use Mobx and react context setup with class components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;withStore HOC injects store into the component as a prop&lt;/strong&gt; so we can accessing it using &lt;code&gt;this.props.store&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I’ve written one small function named &lt;code&gt;toggleTitle&lt;/code&gt; just to show how to modify the store.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That’s it! We’ve completed the mobx setup!&lt;/strong&gt; Now, Whenever we modify the store, all the components with observer get re-rendered automatically.&lt;/p&gt;

&lt;p&gt;If you want to know how to use the &lt;code&gt;useStore&lt;/code&gt; hook then continue reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  useStore hook for functional components
&lt;/h2&gt;

&lt;p&gt;This is an example on How to use &lt;strong&gt;Mobx and react context with functional components&lt;/strong&gt;. Create a folder named &lt;code&gt;components&lt;/code&gt; inside src folder. Create a file named &lt;code&gt;Username.js&lt;/code&gt; inside &lt;code&gt;components&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;Go to &lt;code&gt;Username.js&lt;/code&gt; and paste this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { observer } from "mobx-react";
import { useStore } from "../services/store";

const Username = observer(() =&amp;gt; {
  const store = useStore();
  return &amp;lt;div style={{ fontSize: 14 }}&amp;gt;- By {store.user.name}&amp;lt;/div&amp;gt;;
});

export default Username;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;All we have to do is use observer so that the component re-renders when store is modified. Use the store using &lt;code&gt;useStore&lt;/code&gt; hook. It is as simple as that.&lt;/p&gt;

&lt;p&gt;Now import the &lt;code&gt;Username&lt;/code&gt; in &lt;code&gt;Home.js&lt;/code&gt; and use it.&lt;/p&gt;

&lt;p&gt;Final code looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from "react";
import logo from "../logo.svg";
import "../App.css";
import Username from "../components/Username";
import { observer } from "mobx-react";
import { withStore } from "../services/store";

@withStore
@observer
class Home extends Component {
  toggleTitle = () =&amp;gt; {
    const { store } = this.props;
    if (store.title === "Coding is Love") {
      store.setTitle("Mobx React Context");
    } else {
      store.setTitle("Coding is Love");
    }
  };

  render() {
    const { store } = this.props;
    return (
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;header className="App-header"&amp;gt;
          &amp;lt;img src={logo} className="App-logo" alt="logo" /&amp;gt;
          &amp;lt;a
            className="App-link"
            href="https://codingislove.com"
            target="_blank"
            rel="noopener noreferrer"
          &amp;gt;
            {store.title}
          &amp;lt;/a&amp;gt;
          &amp;lt;button onClick={this.toggleTitle} style={{ margin: 20 }}&amp;gt;
            Toggle title
          &amp;lt;/button&amp;gt;
          &amp;lt;Username /&amp;gt;
        &amp;lt;/header&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}

export default Home;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Final output looks like this :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QA1bAPGS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/mox-react-context-demo-1024x500.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QA1bAPGS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/mox-react-context-demo-1024x500.png" alt="Mobx react context example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Full source code for this boilerplate project is available here – &lt;a href="https://github.com/codingislove01/mobx-react-context"&gt;https://github.com/codingislove01/mobx-react-context&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any questions or feedback then let me know in the comments below &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b2sJRvaS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/270c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b2sJRvaS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/270c.png" alt="✌"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/setup-mobx-react-context/"&gt;How to setup Mobx with react context&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>codingtutorials</category>
      <category>devresources</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Love-hate relationship with react hooks ❤️😏</title>
      <dc:creator>Coding is Love</dc:creator>
      <pubDate>Thu, 25 Jun 2020 15:19:37 +0000</pubDate>
      <link>https://dev.to/codingislove/love-hate-relationship-with-react-hooks-om7</link>
      <guid>https://dev.to/codingislove/love-hate-relationship-with-react-hooks-om7</guid>
      <description>&lt;p&gt;React hooks! The new cool thing in the react eco-system right now! Its been just a year since the concept of &lt;a href="https://reactjs.org/docs/hooks-intro.html"&gt;react hooks&lt;/a&gt; has been introduced. Do you love react hooks or hate them?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mLmi1oO4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/LOVE-HATE-REACT-HOOKS-1024x576.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mLmi1oO4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/LOVE-HATE-REACT-HOOKS-1024x576.png" alt="love-hate-react-hooks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me share my experience with react hooks. I hated them in the beginning. Now, I love using them in a few specific scenarios but still hate them in other scenarios. Let’s dive into it!&lt;/p&gt;

&lt;p&gt;Ever heard of Javascript fatigue? In simple terms, Javascript fatigue is how there’s a new technology every week and JS developers run into using them and there’s a pile of libraries and frameworks stuck in this JS ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hpvj7vbp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/js-devs-new-library.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hpvj7vbp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/js-devs-new-library.gif" alt="devs-react-hooks"&gt;&lt;/a&gt;JS devs when they see a new library!&lt;/p&gt;

&lt;p&gt;Over a period of time, This fatigue has decreased and people are leaning towards well maintained and battle-tested technologies based on how useful they are for the current project but not everyone.&lt;/p&gt;

&lt;p&gt;I think that most developers are using react hooks in their project just because it’s the new cool thing! They neither see the benefits of hooks nor try to understand the best practices in implementing hooks.&lt;/p&gt;

&lt;p&gt;I’ve seen some devs re-writing their entire codebase just to use hooks. You don’t have to do that buddy! You are just wasting your time for nothing. Performance benefits are minimal to hardly noticeable. In addition to that, If you don’t implement hooks in the right way then you’re only making the performance worse!&lt;/p&gt;

&lt;h2&gt;
  
  
  First impressions on react hooks
&lt;/h2&gt;

&lt;p&gt;What’s the first impression that you got while reading react hooks documentation for this first time? Don’t tell me you never read the docs! Some of them never read docs. Only googling randomly 😂&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--11sG7wQC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/what-documentation.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--11sG7wQC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/what-documentation.jpg" alt="what-documentation"&gt;&lt;/a&gt;Documentation! What’s that?&lt;/p&gt;

&lt;p&gt;My first impression was that it is useful to add life cycle hooks and state for some functional components. There are other use cases but these are the main. But I never thought that hooks would be used to entirely replace class components with functional components.&lt;/p&gt;

&lt;h2&gt;
  
  
  First project with react hooks
&lt;/h2&gt;

&lt;p&gt;I never re-wrote any of the old projects with hooks. I wouldn’t do that even now. It’s just a waste of time to re-write the entire project using hooks.&lt;/p&gt;

&lt;p&gt;Then I got one project around 6 months ago which was written by some other developers. It was only around 4 or 5 months since hooks were released at that time. But they had already adopted it. I thought Okay cool, I get to play with react hooks!&lt;/p&gt;

&lt;p&gt;Then I saw the code base!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vPMxiOJ7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/surprised-cat.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vPMxiOJ7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/surprised-cat.gif" alt="surpirsed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code readability with react hooks is terrible if you use them in large components. I want to stress this again :&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Code readability with React hooks is terrible!&lt;/p&gt;

&lt;p&gt;&lt;cite&gt;– A react enthusiast&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;No matter how good you are with react, Code readability with class components would still be a lot better compared to functional components with hooks&lt;/p&gt;

&lt;p&gt;I also saw few mistakes that devs tend to make with hooks. The most imporant mistake is not using useCallback for functions inside a functional component! This is a very bad mistake.&lt;/p&gt;

&lt;p&gt;Stuffing 10 functions and other calculations inside a functional component without useCallback! Now every time that component is re-rendered, all those functions and calculations get executed again which is terrible for performance.&lt;/p&gt;

&lt;p&gt;Let’s cut the chase and talk about what I love and hate about hooks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I love about hooks
&lt;/h2&gt;

&lt;p&gt;It is very useful in a few cases. Here’s an example – I had to handle the back button of several components manually in a react native project. In this case, it was very helpful using a custom hook.&lt;/p&gt;

&lt;p&gt;Here’s the custom hook that i wrote&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useEffect } from 'react';
import { BackHandler } from 'react-native';

export default function useBackHandler(handler) {
  useEffect(() =&amp;gt; {
    BackHandler.addEventListener('hardwareBackPress', handler);

    return () =&amp;gt; {
      BackHandler.removeEventListener('hardwareBackPress', handler);
    };
  });
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now All I have to do is use the custom hook in any component that I want.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useBackHandler(someHandlerFunction)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It is very convenient and readable in this use case.&lt;/p&gt;

&lt;p&gt;The same goes with use cases like adding a custom message listener or internet connection listener.&lt;/p&gt;

&lt;p&gt;It is also useful for keeping related logic together. For example: &lt;code&gt;BackHandler.addEventListener&lt;/code&gt; and &lt;code&gt;BackHandler.removeEventListener&lt;/code&gt; in the above code are related to the same functionality and they are kept in the same place in case of hooks.&lt;/p&gt;

&lt;p&gt;Same code in case of class components would have been separated because &lt;code&gt;addListener&lt;/code&gt; would be in &lt;code&gt;componentDidMount&lt;/code&gt; and &lt;code&gt;removeListener&lt;/code&gt; would be in &lt;code&gt;componentWillUnmount&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It is also useful for smaller functional components which need to maintain just a single state property or minimal state. For example, a modal with open and close state. Functional components with hooks are great for this use case.&lt;/p&gt;

&lt;p&gt;So I get it, hooks are useful in few cases and I love using them in such cases. But I still don’t get why do you need to use hooks for your entire project and every component!&lt;/p&gt;

&lt;h2&gt;
  
  
  What I hate about hooks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Terrible readability
&lt;/h3&gt;

&lt;p&gt;As mentioned earlier, Terrible readability! I have to read a functional component with hooks thoroughly for some time to understand what’s going on there!&lt;/p&gt;

&lt;p&gt;In case of normal class components, Just one glance and you understand what’s going on in that component.&lt;/p&gt;

&lt;p&gt;Stuffing functions with useCallback inside a functional component?&lt;/p&gt;

&lt;p&gt;What’s going inside those multiple &lt;code&gt;useEffect&lt;/code&gt; blocks without names? Only comments can help &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1BmH4zzA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f62d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1BmH4zzA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f62d.png" alt="😭"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  No guidelines for beginners
&lt;/h3&gt;

&lt;p&gt;Beginners tend to make a lot of mistakes with hooks. Specifically not using &lt;code&gt;useCallback&lt;/code&gt;, stuffing a lot of function inside one functional component.&lt;/p&gt;

&lt;p&gt;Inserting wrong dependencies in useEffect blocks&lt;/p&gt;

&lt;p&gt;React docs doesn’t even try to warn the developers not to follow such bad practices. They don’t guide the developers with best practices.&lt;/p&gt;

&lt;p&gt;React team had introduced an eslint plugin which helps in finding some errors such as exhaustive deps rule etc. but it still doesn’t really help that much.&lt;/p&gt;

&lt;p&gt;React team should implement some proper guidelines for hooks so that developers can follow them for the best performance, readability and maintainability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easy to make mistakes
&lt;/h3&gt;

&lt;p&gt;Writing &lt;code&gt;useCallback&lt;/code&gt; for every function? You don’t have to do that for good old class components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;So yea I would use hooks in my project but only for few smaller components. I would stick to class components without any hooks for every other use case. I may be right or wrong. This is just my opinion. Do let me know your thoughts. That would help me learn better &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0FvlDT7J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f60a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0FvlDT7J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f60a.png" alt="😊"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read more &lt;a href="https://codingislove.com/tag/react/"&gt;react articles here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you like react hooks? Drop a comment below &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b2sJRvaS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/270c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b2sJRvaS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://s.w.org/images/core/emoji/12.0.0-1/72x72/270c.png" alt="✌"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8kDmwlTF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/peace-out-skate.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8kDmwlTF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://codingislove.com/wp-content/uploads/2020/06/peace-out-skate.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://codingislove.com/love-hate-react-hooks/"&gt;Love-hate relationship with react hooks ❤️😏&lt;/a&gt; appeared first on &lt;a href="https://codingislove.com"&gt;Coding is Love&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>general</category>
      <category>javascript</category>
      <category>react</category>
    </item>
  </channel>
</rss>
