<?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: alireza valizade</title>
    <description>The latest articles on DEV Community by alireza valizade (@alirezavalizade).</description>
    <link>https://dev.to/alirezavalizade</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%2F69841%2Fa694d3f2-c154-45d3-9f37-b96d16d388ae.jpeg</url>
      <title>DEV Community: alireza valizade</title>
      <link>https://dev.to/alirezavalizade</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alirezavalizade"/>
    <language>en</language>
    <item>
      <title>Boost your React application’s performance by Xstate</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Wed, 24 Feb 2021 11:06:09 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/boost-your-react-application-s-performance-by-xstate-42p8</link>
      <guid>https://dev.to/alirezavalizade/boost-your-react-application-s-performance-by-xstate-42p8</guid>
      <description>&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AtaR9Lsd3KRgUK8-hvdCOeA.jpeg" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AtaR9Lsd3KRgUK8-hvdCOeA.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Performance
&lt;/h4&gt;

&lt;p&gt;Is one of the important keys in every application to have better UX and make users happier (of course you may not care about users happiness, but it makes yourself happier 😃 Because you want to do something in a best way and you enjoy it). Performance is different on the web based applications it depends on the tools you choose and how you use them specially on low memory devices like TVs and Mobiles.&lt;/p&gt;

&lt;h4&gt;
  
  
  State Management
&lt;/h4&gt;

&lt;p&gt;There are a lot of libraries out there that you just install and use them in your project. Some people just using the Context Api it self which is powerful and easy to use, but also has some downsides like unnecessary re-renders, Take a look at this example:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;As you can guess, All the nested components get re-render, You are thinking that I’m wrong I can use &lt;em&gt;useMemo()&lt;/em&gt; or split the component in two and use &lt;em&gt;memo()&lt;/em&gt; , &lt;strong&gt;But everything has a cost so better to avoid them!&lt;/strong&gt; &lt;a href="https://kentcdodds.com/blog/usememo-and-usecallback" rel="noopener noreferrer"&gt;Checkout this interesting article here&lt;/a&gt; from &lt;a href="https://medium.com/u/db72389e89d8" rel="noopener noreferrer"&gt;Kent C. Dodds&lt;/a&gt; If you see the console.count() results in the console then it means React started the &lt;a href="https://reactjs.org/docs/reconciliation.html" rel="noopener noreferrer"&gt;reconciliation&lt;/a&gt; process to detect the diffs there in virtual dom. Sometimes this process is not fast enough and you will see the issues and it becomes slow by decreasing frames, sometimes lags in animation like close a Modal. Again checkout this article from &lt;a href="https://medium.com/u/db72389e89d8" rel="noopener noreferrer"&gt;Kent C. Dodds&lt;/a&gt; to understand better these downsides in React.&lt;/p&gt;

&lt;p&gt;This is just small example and you won’t see the affects but imagine you have thousands of components there. It was really important to me to avoid these kinds of unnecessary re-renders in the application and only update the part that really needs to be update.&lt;/p&gt;

&lt;p&gt;Today going to talk about the Xstate and It benefits to share the state between the application.&lt;/p&gt;

&lt;h4&gt;
  
  
  What is Xstate?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://xstate.js.org/docs/" rel="noopener noreferrer"&gt;Based on the documents the definition of Xstate is:&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JavaScript and TypeScript &lt;a href="https://en.wikipedia.org/wiki/Finite-state_machine" rel="noopener noreferrer"&gt;finite state machines&lt;/a&gt; and &lt;a href="https://www.sciencedirect.com/science/article/pii/0167642387900359/pdf" rel="noopener noreferrer"&gt;statecharts&lt;/a&gt; for the modern web.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And a simple example:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let’s say we have a music streaming application that user can add/remove items from the library, So the flow will be:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Getting User Profile Information (also on refreshing page to detect if user is already logged in)&lt;/li&gt;
&lt;li&gt;Getting User Library Information (Musics, Videos, Podcasts and more…- We need this information everywhere not only in one page)&lt;/li&gt;
&lt;/ol&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2A9glz64rTSDNoBJDoiSD3hQ.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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2A9glz64rTSDNoBJDoiSD3hQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This sounds really easy and straght forward without Xstate, Isn’t?&lt;/p&gt;

&lt;p&gt;It’s possible but it’s not good and clean enough, So the answer is a  &lt;strong&gt;NO&lt;/strong&gt; :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You need to define the states yourself&lt;/li&gt;
&lt;li&gt;You need to define the loadings states yourself&lt;/li&gt;
&lt;li&gt;Your logic and your components getting mixed together, A lots of useEffect(), useState(), useCallback, Promise().then().catch() and callbacks&lt;/li&gt;
&lt;li&gt;You need to create guards in all the actions, For example you need to check if the latest library is loaded then you can add or remove to/from library&lt;/li&gt;
&lt;li&gt;A lots of setState since the datas need to be store somewhere and need to be reactive, &lt;strong&gt;This means a lots of re-renders&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Hard to debugging since you don’t know the states&lt;/li&gt;
&lt;li&gt;Hard to have control on the flow&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I’m sure there are more.&lt;/p&gt;

&lt;p&gt;Behind the state management Xstate gives you powerful control on the flow and different states. If you’re not familiar with the &lt;a href="https://xstate.js.org/docs/" rel="noopener noreferrer"&gt;Xstate first take a look at the documents&lt;/a&gt; since this post is not about learning Xstate it’s about using it.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://xstate.js.org/viz/" rel="noopener noreferrer"&gt;See the result in visiualizer&lt;/a&gt;:&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%2Fcdn-images-1.medium.com%2Fmax%2F1023%2F1%2Acg1rF1gww2DFBYUzf65dxg.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%2Fcdn-images-1.medium.com%2Fmax%2F1023%2F1%2Acg1rF1gww2DFBYUzf65dxg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;THIS IS REALLY COOL!&lt;/strong&gt; You can define all the steps in the machine and transition between them using events or states itself by target key.&lt;/p&gt;

&lt;h4&gt;
  
  
  Using the machine
&lt;/h4&gt;

&lt;p&gt;In a normal way there are some helpers from @xstate/react package, like useMachine() :&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;All is good, We have 3 different components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;LibraryHandler: It doesn’t needs to be update at all since it’s only injected actions.&lt;/li&gt;
&lt;li&gt;LibraryPresent: It only needs to be update when the library.mp3s item has been updated in the store.&lt;/li&gt;
&lt;li&gt;UserProfile: It only needs to be update when user item has been updated in the store.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;But&lt;/strong&gt; we didn’t solve the issue yet, We still will get those nasty unnecessary re-renders and we wan’t to avoid using memoize helpers. So we need atomic updates, We need to run the machine without passing the state to provider, Here is the place that interpret and useService hook will shine:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The authService function will return the service, Eeach service has some useful methods but what we need here are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;start(): to start a service&lt;/li&gt;
&lt;li&gt;stop(): to stop a service&lt;/li&gt;
&lt;li&gt;send(): to send events&lt;/li&gt;
&lt;li&gt;subscribe(): to listen to changes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We need to update our AppProvider component and provide the service instead of state directly.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;So far so good! You see selectors object above that I’ll explain it in a bit.&lt;/p&gt;

&lt;p&gt;Let’s create the subscriber hook:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This hooks takes two main arguments:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;service: A service that has been started&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;selector: A function that receive the state and returns a specific data&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What’s going here?&lt;/p&gt;

&lt;p&gt;It’s easy instead of having one global subscriber we have multiple subscribers, And when the component unmounted we unsubscribe the service. This is kind same as redux selectors working.&lt;/p&gt;

&lt;p&gt;Let’s update the components that needs the data.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Yes this is exactly what we need to get out of the re-render hell in React apps with xstate.&lt;/p&gt;

&lt;h4&gt;
  
  
  Summing up
&lt;/h4&gt;

&lt;p&gt;xstate is definitely one of the coolest thing that I have ever worked with it in our applications. It’s helpful for managing the complicate states there are a lot of cooler things that you can do with it. shout out to &lt;a href="https://medium.com/u/3b9ee2f9eaa2" rel="noopener noreferrer"&gt;David Khourshid&lt;/a&gt; for creating it.&lt;/p&gt;

&lt;p&gt;Thanks for reading, If there is anything I have missed or if there is a better way to do something, Then please let me know. I’d be happy 🤓&lt;/p&gt;

&lt;p&gt;You can find me on &lt;a href="https://github.com/alirezavalizade" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and &lt;a href="https://twitter.com/alirezavlizade" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>xstate</category>
      <category>performance</category>
      <category>react</category>
    </item>
    <item>
      <title>What are the options to download a file in Electron based applications?</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Mon, 18 May 2020 13:08:02 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/what-are-the-options-to-download-a-file-in-electron-based-applications-hcd</link>
      <guid>https://dev.to/alirezavalizade/what-are-the-options-to-download-a-file-in-electron-based-applications-hcd</guid>
      <description>&lt;h4&gt;
  
  
  If you want to deal with downloading files, better read this before start coding 🙌
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gniLWwp6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AxZ0GPDqtP0ppCgZoR_Ziyg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gniLWwp6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AxZ0GPDqtP0ppCgZoR_Ziyg.png" width="800" height="500"&gt;&lt;/a&gt;My own downloader, will be live soon 🔥the icons are fake for now 😀&lt;/p&gt;

&lt;p&gt;I was developing an Electron application a while ago and one of the challenges was downloading files and did some researches about it and saw that the Electron download API wasn’t the only option and it was tricky to use. 🤔&lt;/p&gt;

&lt;p&gt;If your project is growing fast and the future is important for you, Then you need to think about every thing before any actions. An action could be choosing a library or framework or installing a simple package from &lt;a href="http://npmjs.com" rel="noopener noreferrer"&gt;npmjs&lt;/a&gt;. You should think about the consequences and be independent. 😀&lt;/p&gt;

&lt;h4&gt;
  
  
  Here are some topics and questions you may need ask yourself before start coding:
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Has or Will have my application a website version? Like Slack. Just renderer code base and ignoring the native dependencies.
&lt;/h4&gt;

&lt;p&gt;Yeah. This is important thing when you have to deal with files and buffers in your application. You should also consider the web version in the client side there is not main process and there is no IPC module to communicate through the channels. Like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// somewhere in main process
const window = "Your browser window instance";

ipcMain.on('download-url', (event, url) =&amp;gt; {
  download(url);  
});

// somewhere in renderer process
ipcRenderer.send('download-url', "https://google.com/dummy.mp4");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Don’t depend your app to main process which won’t be there in website version. Keep the renderer process isolate as much as you can and reduce the dependencies.&lt;/p&gt;

&lt;p&gt;There are lots of solutions in renderer (Browser), you can use simple &lt;a href="link"&gt;&lt;/a&gt; or fetch Api or third party libraries. You can get buffer or blob using fetch which is what you need.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const download = async (url) =&amp;gt; {
  const response = await fetch(url);
  const file = await response.blob();
  console.log(file);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Note: You can use remote module here to control the file system.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Electron download api is stupid, &lt;a href="https://github.com/electron/electron/issues/12883" rel="noopener noreferrer"&gt;check out this issue on electron’s repository&lt;/a&gt;. You can’t even send custom headers!&lt;/p&gt;
&lt;h4&gt;
  
  
  Do i need to show progress/status on each download item?
&lt;/h4&gt;

&lt;p&gt;Well this depends on the UI, Electron’s &lt;a href="https://www.electronjs.org/docs/api/download-item" rel="noopener noreferrer"&gt;downloadItem&lt;/a&gt; has cool features which you can get the progress and received bytes but that’s not enough! There are a lot of options, You can handle this in both processes. You can use built-in http module or third party packages request which is same but simplified version. In the renderer is same thing, Let’s look at an example from &lt;a href="https://javascript.info/fetch-progress" rel="noopener noreferrer"&gt;javascript.info&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;This is what you need to show the progress/status on downloading items. also will work on the browser, so you’re not depend on the main process.&lt;/p&gt;

&lt;h4&gt;
  
  
  Do i need to have actions? (Cancel, Pause, Resume)
&lt;/h4&gt;

&lt;p&gt;This is also easy to do, you can use the electron downloader api, but there’re few issues for example if you want to cancel an downloading item it’s easy but after restarting the app or losing the download item you won’t be able to resume it. another issue is it cannot be customized even setting simple header. This was the one may things which decided to go for the renderer or another method to use as downloader helper.&lt;/p&gt;

&lt;p&gt;You can use fetch api in renderer to cancel, pause and also resume the download item. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range" rel="noopener noreferrer"&gt;you can easy set a&lt;/a&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range" rel="noopener noreferrer"&gt;Range property header to your downloader which is based on&lt;/a&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range" rel="noopener noreferrer"&gt;fetch .&lt;/a&gt; This is how the streaming services are working like Spotify or Netflix. You can specify which part of file you want to download. Then you can merge the downloader buffer to new or cached buffer in disk suing file-system api or &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API" rel="noopener noreferrer"&gt;IndexedDB&lt;/a&gt; in renderer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort" rel="noopener noreferrer"&gt;for cancelling also fetch has nice and easy way to cancel the request.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vdeXdbLr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AzuVLkyCjVFVLQGsktrjE9Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vdeXdbLr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AzuVLkyCjVFVLQGsktrjE9Q.png" width="800" height="76"&gt;&lt;/a&gt;Spotify 🎺&lt;/p&gt;

&lt;p&gt;You want a challenge? Now you can create a multipart file downloader. Doesn’t matter which api, try fetch or axios or anything in Javascript🔥&lt;/p&gt;

&lt;h4&gt;
  
  
  Is concurrency important for you regarding the performance in the renderer in case you need to show report for each one, and network speed?
&lt;/h4&gt;

&lt;p&gt;You can try and create and async queue which accepts number of concurrency . I’d recommend you to use &lt;a href="https://caolan.github.io/async/v3/docs.html#queue" rel="noopener noreferrer"&gt;async.queue&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Summing up
&lt;/h3&gt;

&lt;p&gt;I’m very positive about the future of the developing cross-platform/web applications and it’s growing fast and I think this was the one of interesting topics to know. I couldn’t find what I was looking for in one article so that was the reason I wrote this one. Hope you enjoyed it. ❤️&lt;/p&gt;

&lt;p&gt;Thanks for reading, If there is anything I have missed, or if there is a better way to do something, Then please let me know. 🤙&lt;/p&gt;

&lt;p&gt;You can find me on &lt;a href="https://github.com/alirezavalizade" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and &lt;a href="https://twitter.com/alirezavlizade" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>downloader</category>
      <category>stream</category>
      <category>javascript</category>
      <category>electron</category>
    </item>
    <item>
      <title>How to deal with forms in Vue (Create your own flexible form library) | Chapter 1</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Sun, 08 Dec 2019 21:22:29 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/how-to-deal-with-forms-in-vue-create-your-own-flexible-form-library-chapter-1-2e66</link>
      <guid>https://dev.to/alirezavalizade/how-to-deal-with-forms-in-vue-create-your-own-flexible-form-library-chapter-1-2e66</guid>
      <description>&lt;p&gt;&lt;em&gt;In this article I’ll show you how much enjoyable is working with forms by building a super flexible library.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Spoiler
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://github.com/alirezavalizade/vue-controlled-form-fields"&gt;Here is min , Which I have been created And would like to share my experiences with you guys.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3bQspL0I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AmhSpDlpeaL83d7_1cXjEAw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3bQspL0I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AmhSpDlpeaL83d7_1cXjEAw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s been years which I worked with complicated forms, I used cool libraries like &lt;a href="https://github.com/final-form/react-final-form/"&gt;FinalForm&lt;/a&gt; or &lt;a href="https://github.com/jaredpalmer/formik"&gt;Formik&lt;/a&gt; and in the past tools like &lt;a href="https://github.com/redux-form/redux-form"&gt;Redux-Form&lt;/a&gt;, But recently I decided to make some challenges for my self and create a library for building forms in Vue which I’d like share my experience here because a lot of developers hates from building forms but I’m going to show you it is not really hard and I like it!&lt;/p&gt;

&lt;h3&gt;
  
  
  Chapters
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Building the form library (We’ll build something basic then we’ll improve it in further steps)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connecting the form components to third party libraries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connecting the form components to native html inputs&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Topics
&lt;/h4&gt;

&lt;p&gt;What we’ll build are just two components Form and Field, Form is the parent and the Fields will be the children of it and then the rest is just about sharing the “State” between them, from parent to children (and Field for custom component and third party libraries) and also something important which is “Reactivity” in Vue.&lt;/p&gt;

&lt;h4&gt;
  
  
  Let’s take a look at what we’re going to build and some features:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Form and Field state (complete report for each Field and the Form)&lt;/li&gt;
&lt;li&gt;State management&lt;/li&gt;
&lt;li&gt;Custom validations (Write your own validation, you just need to return true or false and the error message)&lt;/li&gt;
&lt;li&gt;Handling Validations (Form level and Field level, You can pass your validation to Form or Field)&lt;/li&gt;
&lt;li&gt;Custom Props (like running validation on blur or just focus or …)&lt;/li&gt;
&lt;li&gt;Initializing the Form and listen to changes of it&lt;/li&gt;
&lt;li&gt;Custom Hooks (like “@create(form)”, form example you can use the form methods in your current component)&lt;/li&gt;
&lt;li&gt;Make it subscription based (This could be useful when you need optimisation for your app, Imagine you have 10.000 thousand of dynamic fields in one component)&lt;/li&gt;
&lt;li&gt;Field Arrays and with simple methods like push(), remove(), swipe()&lt;/li&gt;
&lt;li&gt;And more….&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s install a few helpers from Lodash which makes our life easier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add lodash.set lodash.get lodash.isequal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Understanding the Form and Fields state properties
&lt;/h4&gt;

&lt;p&gt;Each Form and Field has state which includes some properties which have special meaning and they happened in the special time which are accessible from outside or inside of the component (You’ll get the point later). Here is a translation of them, Let’s take a look at the states properties:&lt;/p&gt;

&lt;h4&gt;
  
  
  FormState:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mj4FgZqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AlCxeZJYMuLcYEDSFw2veBw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mj4FgZqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AlCxeZJYMuLcYEDSFw2veBw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  FieldState:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NMQvbHaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AL3L8bp6ulQofEuBs0PjebQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NMQvbHaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AL3L8bp6ulQofEuBs0PjebQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  State management
&lt;/h3&gt;

&lt;p&gt;The basic Form.vue will be like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vrStC1uC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AOoIPI6hwbjmET5p8Df7SWQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vrStC1uC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AOoIPI6hwbjmET5p8Df7SWQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yeah, We are going to use all the Vue’s power 😅. We need all of it.&lt;/p&gt;

&lt;p&gt;We added slot to be able render the children there, We also can bind the FormState to get the state of form directly in children.&lt;/p&gt;

&lt;p&gt;Let’s start with fields states in form state. We need to add a property in our data and call it fields like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data() {
 return {
 fields: {},
 };
},
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is main part of controlling the fields, &lt;strong&gt;Basically we are building controlled components which are our fields.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next step, We need something that we could manipulate the state from outside and inside the Form component. so we need a method to register a Field (add fields property in data) and then another one for unregistering it. For registering a field we need the exact field state which we talked above, So we need initial state for each field.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tHoQBO4P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AwRT5XMyzRYsGlE3AULvHIA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tHoQBO4P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AwRT5XMyzRYsGlE3AULvHIA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;registerField() : For registering a new field. Each field has a name, Even for handling nested properties we just need to keep them like this. We can use get to compute them and return them in values , For example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JeBgJplt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AP3pEXUC58w7wh_vowCPOiQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JeBgJplt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AP3pEXUC58w7wh_vowCPOiQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These two fields will be register like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DWnAHA3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ACz6QTkxch63cDIGYt6-KhQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DWnAHA3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ACz6QTkxch63cDIGYt6-KhQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This’ll make our life very easier, We won’t care about the nested fields and the Reactivity for nested properties, But in other hand we have the all the benefits of them, we can compute them and return them in a main object with nested properties using the set method from Lodash.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bKCYmeCM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AU5fKGZhKYGhIoYmVdFOF-w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bKCYmeCM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AU5fKGZhKYGhIoYmVdFOF-w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;unregisterField() : For removing an exist field and setting it to undefined is enough because they are reactive (after registering them).&lt;/p&gt;

&lt;p&gt;initFieldState() : Initial field state, which we’ll make them subscription based using props later for performance reasons. we’ll listen to user actions and calculate them based on it.&lt;/p&gt;

&lt;p&gt;OK, These are fine but as I said we need to manipulate the state from outside and also inside the Form component, How can we access to these methods in everywhere in children (regardless of how deep they are)? We’ll use Provide and Inject here. It’ll save our life from repeating ourselves. &lt;a href="https://dev.to/alirezavalizade/react-context-in-vue-763"&gt;Take a look at my previous article about the Context in Vue.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z-WYOg0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AIAw0K_82Z39zhUyifO3VUw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z-WYOg0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AIAw0K_82Z39zhUyifO3VUw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are enough just for updating the state but not at all we need, one more thing here is required which is need to listen the changes and get the current state of the each field here. I prefer method instead of computed property because I want to get the state based on a parameter which is name of the field, Something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1GYIw7aA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATKcwTV4crGaBwEzTic-D4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1GYIw7aA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ATKcwTV4crGaBwEzTic-D4w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And also provide it to children:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MgVYWwk8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AGitcn3Q5nlQ54V4JXe5RGA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MgVYWwk8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AGitcn3Q5nlQ54V4JXe5RGA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next step, We need a method to change the value of the field directly, We need a name to find the field, and second parameter will be the value to update the field state. Also we need to provide it to children.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// methods
change(name, value) {
 this.fields[name].value = value;
},
// provide
{
 //...
 change: this.change
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let’s see how will look like our Field component, But for now I’ll just handle it for custom components because natives input has more stuff todo which we’ll handle it in further steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bjxhn8yu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0dnmGhH1R-CDX7fe8VhXBw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bjxhn8yu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A0dnmGhH1R-CDX7fe8VhXBw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you see we injected provided methods from Form, In created we’re calling registerField , In destroyed we’re calling unregisterField , That’s what we need to add or remove the fields, We have fieldState computed property which is returning result of getFieldState method by passing name from props. Also we used slot to render dynamic and custom children (components). I’ve created some more computed properties which will make our life easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Custom Validations
&lt;/h3&gt;

&lt;p&gt;Let’s make this flexible, What we need is just passing &lt;a href="https://blog.bitsrc.io/understanding-javascript-mutation-and-pure-functions-7231cc2180d3"&gt;Pure Functio&lt;/a&gt;ns to Field or Form and pass the value of the field and return error messages based on your own conditions. It could be Array of functions (in this case we need to compose them to return first error) or single function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_A8s9ZmJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ADaLuOKyr2OE89vI48DXscg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_A8s9ZmJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ADaLuOKyr2OE89vI48DXscg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling Validations
&lt;/h3&gt;

&lt;p&gt;What we need is create a wrapper function around the validations and run it on each change. Let’s define validate prop in both components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Form
props: {
 ...
 validate: {
 type: Function,
 default: () =\&amp;gt; (null)
 }
}
// Field
props: {
 ...
 validate: {
 type: [Function, Array],
 default: () =\&amp;gt; (null)
 }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Form validation
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4mLd-P6---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ANwvoVqPLWReqJshk-j3y5Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4mLd-P6---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ANwvoVqPLWReqJshk-j3y5Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to call it on every change in form.&lt;/p&gt;

&lt;h4&gt;
  
  
  Field Validation
&lt;/h4&gt;

&lt;p&gt;We need to pass the validate function to field state when we are registering the field on created hook then we can access to it and run them from field state like this,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MdQ4uioe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1vdTlbUD8QBxOmBQGsBKQw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MdQ4uioe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A1vdTlbUD8QBxOmBQGsBKQw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to call it in change(name) function.&lt;/p&gt;

&lt;p&gt;The values is a computed property which returns all the values in field by calling getFieldState(name) .&lt;/p&gt;

&lt;h3&gt;
  
  
  Custom Props
&lt;/h3&gt;

&lt;p&gt;As you know this architecture is flexible you can do whatever you want, I want to show you some of this features like validateOnBlur .&lt;/p&gt;

&lt;p&gt;Let’s define a prop in Form and call it validateOnBlur in form, We want to validate the fields only when blur called instead of change() , The only thing you need is to create blur and focus function and change the field state. Also you need to inject from Field component and pass it to your fields.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DzZa7cjt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AdnXUNPwdRCjjzWvWIZfA4A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DzZa7cjt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AdnXUNPwdRCjjzWvWIZfA4A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I created a helper and called it setIn(name, propertyName, value) which change the field state directly and then calling the validation functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Initializing the Form
&lt;/h3&gt;

&lt;p&gt;As I mentioned every field even nested has only one key (like “user.firstname and user.lastname”) with this trick we can easy handle nested fields.&lt;/p&gt;

&lt;p&gt;Let’s define a prop and call it initialValues and initialize() method in the Form. We also want to re-initialize the Form on changing the initialValues , So let’s also use watcher to listen to changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UGMFUiAi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A2hKksenR8YcqnHMVoe9J5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UGMFUiAi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A2hKksenR8YcqnHMVoe9J5w.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Custom Hooks
&lt;/h3&gt;

&lt;p&gt;Sometimes we need to access to form object in the current component which we defined the form, like here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L2Ok5wA8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_W9v7jsiBzFgFeBQTZJWog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L2Ok5wA8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_W9v7jsiBzFgFeBQTZJWog.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you see, I want to be able to access to form object from FormState to do some stuff which I commented in screenshot. This is the moment we need to define custom hooks for our Form.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1GT-8hG8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AE7a6x6iW44W_NejJYtCtpQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1GT-8hG8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AE7a6x6iW44W_NejJYtCtpQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then we could easily use it like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1eENSZ_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_mfQYGB4ZRPhtNI9gzIdmQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1eENSZ_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A_mfQYGB4ZRPhtNI9gzIdmQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Subscription based
&lt;/h3&gt;

&lt;p&gt;As you know, We have a lot computed properties which are related to reporting the FormState and FieldState which could be a killer for us when talking to performance. Because they have a lot of logic inside themselves which need to be calculated, Also they’re listening to each change to be called.&lt;/p&gt;

&lt;p&gt;Let’s define a prop in Form or Field and call it subscriptionItems, Then we could attach dynamic compute properties beforeCreated life cycle hook in Vue,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R-HpUOIA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ARExilZTt7uYXnCmnbeZImQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R-HpUOIA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ARExilZTt7uYXnCmnbeZImQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We could do the same thing for Field.&lt;/p&gt;

&lt;h3&gt;
  
  
  Field Arrays
&lt;/h3&gt;

&lt;p&gt;Again, I should to notice that, Our fields are just simple strings with valid identity in Javascript for defining properties in objects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EN6-e7Q_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AGtEcf2V7sTjkp2L1Fe6C-A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EN6-e7Q_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AGtEcf2V7sTjkp2L1Fe6C-A.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The values computed property is handling with set() from Lodash. So you can guess what’s the output of it. But this is not enough for having dynamic fields or some kind of a repeater which can control by user and also programmer.&lt;/p&gt;

&lt;p&gt;For handling this you could easily create same thing with Field component but having more methods like map, push, remove then pass it to fieldState() , Responsibly of map is just returning array of names and then push is for adding new row or object to our value in fieldState and remove for removing an item from fieldState .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rF4xOFBX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AD11szhrDjvhvaACOxI0s4Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rF4xOFBX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AD11szhrDjvhvaACOxI0s4Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The you can use it like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WDlcRsyI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AnqApOJaA0hKZre_PI9y3Rg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WDlcRsyI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AnqApOJaA0hKZre_PI9y3Rg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iZ1VHvpE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/540/1%2AlUv6YqZUkPVN6vmZNNgSmg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iZ1VHvpE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/540/1%2AlUv6YqZUkPVN6vmZNNgSmg.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  conclusion 🎉
&lt;/h3&gt;

&lt;p&gt;Yeah, We made it. Forms always are something interesting and I like to work with them and help others to create what they want. Thanks for reading it.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://github.com/alirezavalizade/vue-controlled-form-fields"&gt;Here is mine, What I have been build. You can go over the code and understand it easily, I’m open to help you 👷‍♂️ , If you have question open an issue on Github or Respond here.&lt;/a&gt;
&lt;/h4&gt;

&lt;h3&gt;
  
  
  Live demo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/s/simple-form-using-vue-controlled-form-fields-z2twq?fontsize=14&amp;amp;hidenavigation=1&amp;amp;theme=dark"&gt;https://codesandbox.io/s/simple-form-using-vue-controlled-form-fields-z2twq?fontsize=14&amp;amp;hidenavigation=1&amp;amp;theme=dark&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://github.com/alirezavalizade/vue-controlled-form-fields"&gt;FOR MORE EXAMPLES CLICK ON THIS LINK&lt;/a&gt;
&lt;/h4&gt;

</description>
      <category>javascript</category>
      <category>vue</category>
      <category>forms</category>
      <category>statemanagement</category>
    </item>
    <item>
      <title>Rendering images smoothly using React Hooks</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Mon, 11 Nov 2019 16:01:59 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/rendering-images-smoothly-using-react-hooks-hkp</link>
      <guid>https://dev.to/alirezavalizade/rendering-images-smoothly-using-react-hooks-hkp</guid>
      <description>&lt;p&gt;&lt;em&gt;simple hook to render images smoothly.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this article I’m going to create very simple Hook to render images smoothly on the screen (Not really rendering but sort of trick).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a file “useImage.js” and wrap it with “Hooks” directory with these contents:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xLDrLHL3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2Ar-Z9gI8lnsItMOAV_im-0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xLDrLHL3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2Ar-Z9gI8lnsItMOAV_im-0w.png" width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is very basic hook you can add your own stuff, it depends on your needs, like handling errors or whatever which is related to image.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Let’s add some styles to handle the transitions:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jBOS7YVh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2A8Hni6blWdXPeMMdWsgkqNA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jBOS7YVh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2A8Hni6blWdXPeMMdWsgkqNA.png" width="800" height="305"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I’m going to create a “Cover” component to reuse it everywhere.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CNihHTXq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AAEWwZkuBz9s2pZDAs-X6eQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CNihHTXq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AAEWwZkuBz9s2pZDAs-X6eQ.png" width="800" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s see the result.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo Time
&lt;/h3&gt;

&lt;p&gt;Check it out on &lt;a href="https://codesandbox.io/s/boring-austin-beief" rel="noopener noreferrer"&gt;Sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZlzA392x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/600/1%2AtSuDSmoMOKTP7LQ2rq7qoQ.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZlzA392x--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/600/1%2AtSuDSmoMOKTP7LQ2rq7qoQ.gif" width="600" height="752"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>hooks</category>
      <category>animation</category>
    </item>
    <item>
      <title>React Context in Vue</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Thu, 31 Oct 2019 23:05:29 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/react-context-in-vue-763</link>
      <guid>https://dev.to/alirezavalizade/react-context-in-vue-763</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Och9zL6A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1000/1%2ADQjqzOr8dgD0Av1252yUww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Och9zL6A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1000/1%2ADQjqzOr8dgD0Av1252yUww.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  This article is about switching to Vue.js with Context mindset.
&lt;/h4&gt;

&lt;p&gt;I think these days every developer have heard about the context in React.js, So I’ll straightly go over the code and the solution. If you’re not familiar with Reacts context &lt;a href="https://reactjs.org/docs/context.html" rel="noopener noreferrer"&gt;click on the link&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Provide And Inject
&lt;/h3&gt;

&lt;p&gt;If you are a React developer and thinking like React “context” you cannot work with Vue.js without the Provide and Inject feature (I mean it’s hard, really).&lt;/p&gt;

&lt;p&gt;Let’s see a simple example of Provide and Inject:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O8L07T_u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2A516MhQFFRZJsGFO-c3w5AA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O8L07T_u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2A516MhQFFRZJsGFO-c3w5AA.png" width="800" height="359"&gt;&lt;/a&gt;A simple example of Provide and Inject&lt;/p&gt;

&lt;p&gt;So basically “Provide” it’s for passing data or methods to the children with “Inject” property, regardless of how deep they are, But what will be solved exactly?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Not using props to pass the data to children like 5 levels&lt;/li&gt;
&lt;li&gt;Clean, simple and powerful store management and not using the Vuex when it’s not necessary&lt;/li&gt;
&lt;li&gt;DRY&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Vue source code
&lt;/h3&gt;

&lt;p&gt;These two screenshots are part of provide and injection in Vue source code (after normalisation them).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide: You can write it as Object or a function which returns an Object which you can access to the component context (this) and you can pass method or computed properties or whatever in the component.&lt;/li&gt;
&lt;li&gt;Inject: You can write it as an Array of strings or Object with a default value.&lt;/li&gt;
&lt;li&gt;about resolveInjection function: It’s a simple loop over the inject object and looking for the provider with a “while” loop to resolve it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dh3r8hDs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AWJD5a-ldcsT2fL25UydQ_g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dh3r8hDs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AWJD5a-ldcsT2fL25UydQ_g.png" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P1j9vf4X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AJ3Yaog6t4GWo9sq0G71qAQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P1j9vf4X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AJ3Yaog6t4GWo9sq0G71qAQ.png" width="800" height="614"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Simple store management with Provide and Inject
&lt;/h3&gt;

&lt;p&gt;We’ll build the “famous theme handler” with context to understand how easy and useful is the context.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://cli.vuejs.org/" rel="noopener noreferrer"&gt;Use Vue cli to bootstrap your project&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Now, You can have a structure like this.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G6olsXU---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/490/1%2AawEboqJUFfX0o8VIfC_I1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G6olsXU---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/490/1%2AawEboqJUFfX0o8VIfC_I1g.png" width="490" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you see we have a weird “context” folder which we’ll look into it in further steps. :)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a Javascript file in “styles” folder and call it “themes.js” with these contents.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rfmc2dcl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AIxbjw1sKdEHi-KpyMzblsw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rfmc2dcl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AIxbjw1sKdEHi-KpyMzblsw.png" width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Let’s go to “contexts” folder, Create a JS file and call it “Theme.js”.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;We have two components in the same file with the string templates in this case you need the standalone build, &lt;a href="https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only" rel="noopener noreferrer"&gt;here is a helpful section explaining&lt;/a&gt; (of course you can have separate files like ThemeProvider.vue and ThemeConsumer.vue).&lt;/li&gt;
&lt;li&gt;First one is our Provider which provides the data and methods to injectors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--17wmqOz7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AHTEVcBOJH8XMEZtQLm8nUA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--17wmqOz7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AHTEVcBOJH8XMEZtQLm8nUA.png" width="800" height="927"&gt;&lt;/a&gt;Theme.js&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Second one is our Injector (Consumer) which is able to inject the provided data. actually second one is just a helper to write less code and reuse it every where.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X239DErG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AoRCLbx14ghFd_CL9eWPZJw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X239DErG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AoRCLbx14ghFd_CL9eWPZJw.png" width="800" height="250"&gt;&lt;/a&gt;Theme.js&lt;/p&gt;

&lt;p&gt;And that’s it, we are good to go. You just need to import the Consumer and then you can access to provided data using “slot-scope”.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You’ll need to import and wrap the Provider inside your application root. Unfortunately there’s no Hooks in the current versions of Vue yet to use it like React (useContext).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hd1F9H_N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AKRUaQRhZwfKBpDD7U0HWCA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hd1F9H_N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AKRUaQRhZwfKBpDD7U0HWCA.png" width="800" height="656"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Let see some magics. We have two components which we’ll see the different use cases.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;First component: We see a component which wrapped with the Consumer and you can access to the data and methods by “slot-scope”. You can bind styles and pass the theme variables or you can bind classes and handle the styles and theme using css!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KJFTwu9A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AcPfvoTujOf2bnABgT4w8nQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KJFTwu9A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AcPfvoTujOf2bnABgT4w8nQ.png" width="800" height="780"&gt;&lt;/a&gt;FirstComp.vue&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Second component: We see a component which wrapped with a “div” in template and includes two ThemeConsumer, this means you can have a lot of Consumers in every where also you can override them easily.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--juJ5vRqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AlTQlSbEljZq31U-VLU6THw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--juJ5vRqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AlTQlSbEljZq31U-VLU6THw.png" width="800" height="1468"&gt;&lt;/a&gt;SecondComp.vue&lt;/p&gt;

&lt;h3&gt;
  
  
  Live demo and source code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://medium.com/media/db4b42c5bcdecd87f5da93b3902772b6/href" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://medium.com/media/db4b42c5bcdecd87f5da93b3902772b6/href" rel="noopener noreferrer"&gt;https://medium.com/media/db4b42c5bcdecd87f5da93b3902772b6/href&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep in mind
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note: the&lt;/strong&gt;  &lt;strong&gt;provide and&lt;/strong&gt;  &lt;strong&gt;inject bindings are NOT reactive. This is intentional. However, if you pass down an observed object, properties on that object do remain reactive.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Summing up
&lt;/h3&gt;

&lt;p&gt;No matter if you are working with React or Vue, “Context is everything”! It’s very simple to understand, divide you application code and structure. It solves the problem of passing stuff deep down your component.&lt;/p&gt;

&lt;p&gt;Thanks for reading, If there is anything I have missed, or if there is a better way to do something, then please let me know. 🤙&lt;/p&gt;

&lt;p&gt;You can find me on &lt;a href="https://github.com/alirezavalizade" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and &lt;a href="https://twitter.com/alirezavlizade" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>vuex</category>
      <category>react</category>
      <category>vue</category>
      <category>javascript</category>
    </item>
    <item>
      <title>KAMPONENT</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Sat, 05 May 2018 08:31:08 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/kamponent-36p2</link>
      <guid>https://dev.to/alirezavalizade/kamponent-36p2</guid>
      <description>&lt;p&gt;If you like this library please click on the start button on github.&lt;br&gt;
&lt;a href="https://github.com/cooldrip/komponent" rel="noopener noreferrer"&gt;https://github.com/cooldrip/komponent&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  kamponent
&lt;/h1&gt;

&lt;p&gt;a component for creating react components 🏃&lt;/p&gt;
&lt;h3&gt;
  
  
  This library is not released yet
&lt;/h3&gt;
&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;kamponent &lt;span class="nt"&gt;--save&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add kamponent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 1
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Kamponent&lt;/span&gt; &lt;span class="nx"&gt;pure&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&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;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setState&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="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="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h3&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&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;/h3&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;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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&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="o"&gt;&amp;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="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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&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="o"&gt;&amp;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;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Kamponent&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 2
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Kamponent&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;props&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="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="o"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h3&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;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&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;/h3&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;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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;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="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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decrement&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="o"&gt;&amp;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;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Kamponent&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  props
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Working&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;children&lt;/td&gt;
&lt;td&gt;function or array or object&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;initialState&lt;/td&gt;
&lt;td&gt;object&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pure&lt;/td&gt;
&lt;td&gt;bool&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;didMount&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;didCatch&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;willUnmount&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;shouldUpdate&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;didUpdate&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;snapshotBeforeUpdate&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  params in functions
&lt;/h3&gt;

&lt;h6&gt;
  
  
  note: you can access to this parameters from functions and children (if it be function).
&lt;/h6&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Working&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;state&lt;/td&gt;
&lt;td&gt;any&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;props&lt;/td&gt;
&lt;td&gt;any&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setState&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;forceUpdate&lt;/td&gt;
&lt;td&gt;function&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>Background-Image-On-Load</title>
      <dc:creator>alireza valizade</dc:creator>
      <pubDate>Sat, 28 Apr 2018 05:45:18 +0000</pubDate>
      <link>https://dev.to/alirezavalizade/background-image-on-load-13b</link>
      <guid>https://dev.to/alirezavalizade/background-image-on-load-13b</guid>
      <description>&lt;h1&gt;
  
  
  Background-Image-On-Load
&lt;/h1&gt;

&lt;p&gt;A simple way to check &lt;code&gt;background-image&lt;/code&gt; is loaded.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;background-image-on-load &lt;span class="nt"&gt;--save&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add background-image-on-load
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Usage
&lt;/h3&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;Component&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="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;BackgroundImageOnLoad&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;background-image-on-load&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;bgIsLoaded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nf"&gt;render&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;bgIsLoaded&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&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;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; 
            &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;backgroundPosition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;backgroundSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cover&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;backgroundImage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`url(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;bgIsLoaded&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://picsum.photos/310/310?blur&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://picsum.photos/1600/310&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;BackgroundImageOnLoad&lt;/span&gt;
            &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://unsplash.it/1200/310?random&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;onLoadBg&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
              &lt;span class="na"&gt;bgIsLoaded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
            &lt;span class="p"&gt;})}&lt;/span&gt;
            &lt;span class="nx"&gt;onError&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
          &lt;span class="sr"&gt;/&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;span class="p"&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="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you like this library please click on the start button on github.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/alirezavalizade/background-image-on-load" rel="noopener noreferrer"&gt;https://github.com/alirezavalizade/background-image-on-load&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>style</category>
      <category>css</category>
    </item>
  </channel>
</rss>
