<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Furkan's Notes]]></title><description><![CDATA[Furkan's Notes]]></description><link>https://blog.furkanozbek.com</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 05:12:36 GMT</lastBuildDate><atom:link href="https://blog.furkanozbek.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[React Hooks: useLayoutEffect]]></title><description><![CDATA[1 - Definition
useLayoutEffect runs synchronously immediately after React has performed all DOM mutations. 
This can be useful if you need to make DOM measurements (like getting the scroll position or other styles for an element) and then make DOM mu...]]></description><link>https://blog.furkanozbek.com/react-hooks-uselayouteffect</link><guid isPermaLink="true">https://blog.furkanozbek.com/react-hooks-uselayouteffect</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Sun, 19 Sep 2021 08:42:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1632041029680/f2Hyy56CU.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-definition">1 - Definition</h2>
<p><strong>useLayoutEffect</strong> runs <strong>synchronously</strong> immediately after React has performed all DOM mutations. </p>
<p>This can be useful if you need to make DOM measurements (like getting the scroll position or other styles for an element) and then make DOM mutations or trigger a synchronous re-render by updating state.</p>
<h2 id="2-snytax">2 - Snytax</h2>
<p>It looks exactly like useEffect but different use-cases. Here is the syntax for it;</p>
<pre><code class="lang-jsx">useEffect(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">// do side effects</span>
  <span class="hljs-keyword">return</span> <span class="hljs-function">() =&gt;</span> <span class="hljs-comment">/* cleanup */</span>
}, [dependency, array]);

useLayoutEffect(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">// do side effects</span>
  <span class="hljs-keyword">return</span> <span class="hljs-function">() =&gt;</span> <span class="hljs-comment">/* cleanup */</span>
}, [dependency, array]);
</code></pre>
<h2 id="3-useeffect-vs-uselayouteffect">3 - useEffect vs useLayoutEffect</h2>
<p><strong>useEffect</strong>
(Component &gt; State Changes &gt; Component Renders &gt; Rendered Component is Printed on Screen &gt; useEffect runs)</p>
<blockquote>
<p>useEffect will run after React renders your component and ensures that your effect callback does not block browser painting.</p>
</blockquote>
<p><strong>useLayoutEffect</strong>
(Component &gt; State Changes &gt; Component Renders &gt; useLayoutEffect runs &gt; Rendered Component is Printed on Screen)</p>
<blockquote>
<p>useLayoutEffect runs synchronously immediately after React has performed all DOM mutations.</p>
</blockquote>
<h2 id="4-one-possible-example">4 - One Possible Example</h2>
<p>If your effect is mutating the DOM (via a node ref) and the DOM mutation will change the look of the DOM node between the time that it is rendered and your effect mutates it, then you want to use useLayoutEffect.</p>
<p>Otherwise the user could see a flicker when your DOM mutations take effect. This is pretty much the only time you want to avoid useEffect and use useLayoutEffect instead.</p>
<h2 id="5-summary">5 - Summary</h2>
<p>Try use useEffect most of the time, if you are really need to mutate dom directly go take a look similar examples first before applying useLayoutEffect.</p>
<ul>
<li><strong>useLayoutEffect:</strong> If you need to mutate the DOM and/or <strong>do need</strong> to perform measurements</li>
<li><strong>useEffect:</strong> If you don't need to interact with the DOM at all (%99.99 of the time you will use this)</li>
</ul>
<h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://kentcdodds.com/blog/useeffect-vs-uselayouteffect">useEffect vs useLayoutEffect</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[6 Tips To Achieve Your Goal]]></title><description><![CDATA[1 - Define Your Goals
The first thing you need to do is defining what you want to do to keep you motivated. It can be working full time in a developer job or learning a new language.

2 - Create a Schedule
Then give which time of the day/week you can...]]></description><link>https://blog.furkanozbek.com/6-tips-to-achieve-your-goal</link><guid isPermaLink="true">https://blog.furkanozbek.com/6-tips-to-achieve-your-goal</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Fri, 17 Sep 2021 16:55:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897778105/YFBZiJ0NQ.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-define-your-goals">1 - Define Your Goals</h2>
<p>The first thing you need to do is defining what you want to do to keep you motivated. It can be working full time in a developer job or learning a new language.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897766553/bP8jGaRxv.png" alt="undraw_Goals_re_lu76" /></p>
<h2 id="2-create-a-schedule">2 - Create a Schedule</h2>
<p>Then give which time of the day/week you can work on that.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897768361/3E7SlqhhK.png" alt="undraw_online_organizer_ofxm" /></p>
<h2 id="3-start-simple">3 - Start Simple</h2>
<p>Instead of focusing on your <strong>big goal</strong>, divide your goal into sub-goals. This will help you to achieve them much more easily and with that way you can track your progress.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897770114/fuDS7Ro9o.png" alt="undraw_Timeline_re_aw6g" /></p>
<h2 id="4-remove-any-distractions">4 - Remove any Distractions</h2>
<p>During researching or creating projects, try to disable all notifications while working. 
Just put yourself into work mode in that time. Believe me, this can increase your productivity <strong>tremendously</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897772264/YHl2ImMPI.png" alt="undraw_Notify_re_65on" /></p>
<h2 id="5-progress-your-work">5 - Progress Your Work</h2>
<p>At the end of the day, note what you have done. This will make you be proud of yourself and help you to realize how easily you can improve yourself. Maybe in the first week, you do not care much, but after that, you will see what you have done.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897773911/mcClAOkn8.png" alt="undraw_In_progress_re_m1l6" /></p>
<h2 id="6-share-what-you-have-learned">6 - Share What You Have Learned</h2>
<p>Try to share what you have learned with others, this will make you more confident about what you have done and it will help you grow your audience in the tech community. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631897775828/c8hbgQTB5.png" alt="undraw_pizza_sharing_wxop" /></p>
<p>This can also be useful in interviews.</p>
<p>You can also share pizza of course :)</p>
]]></content:encoded></item><item><title><![CDATA[How to Deploy Your App to Netlify]]></title><description><![CDATA[1. Push Your Code to Any Version Control Applications
The first thing you need to do is push your git repository to any version control application. You can use any one of these;

Github
Gitlab
Bitbucket

2. Register to Netlify
Once you have a reposi...]]></description><link>https://blog.furkanozbek.com/how-to-deploy-your-app-to-netlify</link><guid isPermaLink="true">https://blog.furkanozbek.com/how-to-deploy-your-app-to-netlify</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Thu, 16 Sep 2021 09:41:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785297380/71vKtMtJq.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-push-your-code-to-any-version-control-applications">1. Push Your Code to Any Version Control Applications</h2>
<p>The first thing you need to do is push your git repository to any version control application. You can use any one of these;</p>
<ul>
<li>Github</li>
<li>Gitlab</li>
<li>Bitbucket</li>
</ul>
<h2 id="2-register-to-netlify">2. Register to Netlify</h2>
<p>Once you have a repository inside any given application just signup to <strong>Netlify</strong> and connect them.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785285897/D4t3ALEam.png" alt="Register" /></p>
<h2 id="3-creating-new-site">3. Creating New Site</h2>
<p>Now, you should be on the team page where you can see your applications which right now you do not have but don't worry we'll add them right now.</p>
<p>In there you can either click "New site from Git" button or you can visit <strong>https://app.netlify.com/start</strong></p>
<p><strong>You will see this screen</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785287824/6_dDx6RM2a.png" alt="new site" /></p>
<p>You should click the button which you are storing your repository right now. In my case it is Github.</p>
<h2 id="4-connecting-accounts">4. Connecting Accounts</h2>
<p>After that, you should see a connection screen where you will connect your Github account with Netlify.</p>
<p>Or if you are connected you will see a text that says <strong>"Authorized"</strong> which indicates that you already connect your account with Github<em>**</em></p>
<h2 id="5-choose-a-project">5. Choose a project</h2>
<p>Now select the project(repository) you want and continue</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785289726/mdmmQIj2q.png" alt="Choose Project" /></p>
<h2 id="6-choosing-site-settings">6. Choosing Site Settings</h2>
<p>Now you can choose the owner of this application and choose which branch to deploy. Netlify will listen to that branch and if any changes published it will rebuild your application and run the tests for you.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785291670/V3M0qC43j.png" alt="Site Settings" /></p>
<p>You can also choose the build command that is needed to run to generate the build folder. This folder name can be different from framework to framework. So make sure to run on your local first to see the folder name.</p>
<p>And once everything is ok deploy your site.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785293491/oAitTNMa7.png" alt="Site Settings-2" /></p>
<h2 id="7-congratulations">7. Congratulations</h2>
<p>Congratz! You deployed your first application to Netlify.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631785295275/JyMe3nf96.png" alt="Last" /></p>
]]></content:encoded></item><item><title><![CDATA[5 Ways To Host Your Applications]]></title><description><![CDATA[1. Surge
Surge is a cloud platform for hosting static websites, which is extremely simple to use but offers customization options for those who need them.

2. Firebase
Firebase Hosting is a fully managed hosting service for static and dynamic content...]]></description><link>https://blog.furkanozbek.com/5-ways-to-host-your-applications</link><guid isPermaLink="true">https://blog.furkanozbek.com/5-ways-to-host-your-applications</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Wed, 15 Sep 2021 07:46:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631692030571/-7hJmd3ld.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-surge">1. Surge</h2>
<p>Surge is a cloud platform for hosting static websites, which is extremely simple to use but offers customization options for those who need them.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631692020574/XDpxc4s8K.png" alt="Surge" /></p>
<h2 id="2-firebase">2. Firebase</h2>
<p>Firebase Hosting is a fully managed hosting service for static and dynamic content as well as microservices.</p>
<p>The service is backed by SSD storage and a global CDN (content delivery network).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631692022458/Dc41WOf9e.png" alt="Firebase" /></p>
<h2 id="3-vercel">3. Vercel</h2>
<p>Vercel is a hosting platform for frontend frameworks. After you create a pr it will automatically create an environment for you so that the team can check it before merging it. So useful!</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631692024219/C2wQzpIIA.png" alt="Vercel" /></p>
<h2 id="4-github-pages">4. Github Pages</h2>
<p>GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process and publishes a website</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631692026526/5Xfb83Fw8.png" alt="Github Pages" /></p>
<h2 id="5-netlify">5. Netlify</h2>
<p>Netlify is a web hosting and automation platform that accelerates <strong>development productivity</strong></p>
<p>I deployed most of my projects to Netlify because it is so easy to use, it is supporting custom domains, and much more.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631692028398/gQErxDHBF.png" alt="Netlify" /></p>
<h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://dev.to/suhailkakar/6-ways-to-host-your-react-js-app-for-free-2163">6 Ways to Host Your React JS App For Free</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Array methods that you should know]]></title><description><![CDATA[1- findIndex
The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test.
const array1 = [5, 12, 8, 130, 44];

const isL...]]></description><link>https://blog.furkanozbek.com/array-methods-that-you-should-know</link><guid isPermaLink="true">https://blog.furkanozbek.com/array-methods-that-you-should-know</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Tue, 14 Sep 2021 08:02:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631606610556/jQIMwOpSG.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-findindex">1- findIndex</h2>
<p>The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test.</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> array1 = [<span class="hljs-number">5</span>, <span class="hljs-number">12</span>, <span class="hljs-number">8</span>, <span class="hljs-number">130</span>, <span class="hljs-number">44</span>];

<span class="hljs-keyword">const</span> isLargeNumber = <span class="hljs-function">(<span class="hljs-params">element</span>) =&gt;</span> element &gt; <span class="hljs-number">13</span>;

<span class="hljs-built_in">console</span>.log(array1.findIndex(isLargeNumber));
<span class="hljs-comment">// expected output: 3</span>
</code></pre>
<ul>
<li>find() method, which returns the value of an array element, instead of its index.</li>
<li>Returns The index of the first element in the array that passes the test. Otherwise, -1.</li>
</ul>
<pre><code class="lang-jsx"><span class="hljs-comment">// EXAMPLE 1</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">isPrime</span>(<span class="hljs-params">num</span>) </span>{
  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">2</span>; num &gt; i; i++) {
    <span class="hljs-keyword">if</span> (num % i == <span class="hljs-number">0</span>) {
      <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
    }
  }
  <span class="hljs-keyword">return</span> num &gt; <span class="hljs-number">1</span>;
}

<span class="hljs-built_in">console</span>.log([<span class="hljs-number">4</span>, <span class="hljs-number">6</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>, <span class="hljs-number">12</span>].findIndex(isPrime)); <span class="hljs-comment">// -1, not found</span>
<span class="hljs-built_in">console</span>.log([<span class="hljs-number">4</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">9</span>, <span class="hljs-number">12</span>].findIndex(isPrime)); <span class="hljs-comment">// 2 (array[2] is 7)</span>
</code></pre>
<pre><code class="lang-jsx"><span class="hljs-comment">// EXAMPLE 2</span>
<span class="hljs-keyword">const</span> fruits = [<span class="hljs-string">"apple"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"cantaloupe"</span>, <span class="hljs-string">"blueberries"</span>, <span class="hljs-string">"grapefruit"</span>];

<span class="hljs-keyword">const</span> index = fruits.findIndex(<span class="hljs-function"><span class="hljs-params">fruit</span> =&gt;</span> fruit === <span class="hljs-string">"blueberries"</span>);

<span class="hljs-built_in">console</span>.log(index); <span class="hljs-comment">// 3</span>
<span class="hljs-built_in">console</span>.log(fruits[index]); <span class="hljs-comment">// blueberries</span>
</code></pre>
<h2 id="2-includes">2- includes</h2>
<p>The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> array1 = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>];

<span class="hljs-built_in">console</span>.log(array1.includes(<span class="hljs-number">2</span>));
<span class="hljs-comment">// expected output: true</span>

<span class="hljs-keyword">const</span> pets = [<span class="hljs-string">'cat'</span>, <span class="hljs-string">'dog'</span>, <span class="hljs-string">'bat'</span>];

<span class="hljs-built_in">console</span>.log(pets.includes(<span class="hljs-string">'cat'</span>));
<span class="hljs-comment">// expected output: true</span>

<span class="hljs-built_in">console</span>.log(pets.includes(<span class="hljs-string">'at'</span>));
<span class="hljs-comment">// expected output: false</span>
</code></pre>
<ul>
<li>When comparing strings and characters, includes() is case-sensitive.</li>
<li>Returns: A Boolean which is true if the value searchElement is found within the array (or the part of the array indicated by the index fromIndex, if specified).</li>
</ul>
<h2 id="3-isarray">3- isArray</h2>
<p>The Array.isArray() method determines whether the passed value is an Array.</p>
<pre><code class="lang-jsx"><span class="hljs-built_in">Array</span>.isArray([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]);  <span class="hljs-comment">// true</span>
<span class="hljs-built_in">Array</span>.isArray({<span class="hljs-attr">foo</span>: <span class="hljs-number">123</span>}); <span class="hljs-comment">// false</span>
<span class="hljs-built_in">Array</span>.isArray(<span class="hljs-string">'foobar'</span>);   <span class="hljs-comment">// false</span>
<span class="hljs-built_in">Array</span>.isArray(<span class="hljs-literal">undefined</span>);  <span class="hljs-comment">// false</span>
</code></pre>
<ul>
<li>Returns true if the value is an Array; otherwise, false.</li>
</ul>
<h2 id="4-some">4- Some</h2>
<p>The some() method tests whether at least one element in the array passes the test implemented by the provided function. It returns true if, in the array, it finds an element for which the provided function returns true; otherwise it returns false. It doesn't modify the array.</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> array = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>];

<span class="hljs-comment">// checks whether an element is even</span>
<span class="hljs-keyword">const</span> even = <span class="hljs-function">(<span class="hljs-params">element</span>) =&gt;</span> element % <span class="hljs-number">2</span> === <span class="hljs-number">0</span>;

<span class="hljs-built_in">console</span>.log(array.some(even));
<span class="hljs-comment">// expected output: true</span>
</code></pre>
<ul>
<li>Returns true if the callback function returns a truthy value for at least one element in the array. Otherwise, false.</li>
</ul>
<h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">MDN Docs | Array</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[React Hooks: useRef]]></title><description><![CDATA[1. Definition
useRef is a built-in React hook that accepts one argument as the initial value and returns a reference (aka ref). 
A reference is an object having a special property current
There are two main uses of useRef;

Accessing the DOM nodes or...]]></description><link>https://blog.furkanozbek.com/react-hooks-useref</link><guid isPermaLink="true">https://blog.furkanozbek.com/react-hooks-useref</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Mon, 13 Sep 2021 18:46:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631558853213/YICIuZ1ty.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-definition">1. Definition</h2>
<p><strong>useRef</strong> is a built-in React hook that accepts one argument as the initial value and returns a reference (aka ref). </p>
<p>A reference is an object having a special property <code>current</code></p>
<p>There are two main uses of <strong>useRef</strong>;</p>
<ul>
<li>Accessing the DOM nodes or React elements</li>
<li>Keeping a mutable variable.</li>
</ul>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> refContainer = useRef(initialValue);
</code></pre>
<h2 id="2-accessing-the-dom-elements">2. Accessing the DOM Elements</h2>
<p><strong>This is performed in 3 steps:</strong></p>
<ol>
<li>Define the reference to access the element </li>
<li>Assign the reference to <code>ref</code> attribute of the element</li>
<li>After mounting, <code>elementRef.current</code> points to the DOM element.</li>
</ol>
<p>This is equivalent of</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">import</span> React, { useRef } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> CustomTextInput = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> textInput = useRef();

  focusTextInput = <span class="hljs-function">() =&gt;</span> textInput.current.focus();

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">{textInput}</span> /&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{focusTextInput}</span>&gt;</span>Focus the text input<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/&gt;</span></span>
  );
}
</code></pre>
<h2 id="3-keeping-a-mutable-variable">3. Keeping a Mutable Variable</h2>
<p>We have two ways of keeping data between re-renders:</p>
<ul>
<li><strong>In the component state</strong>: Every time the state changes, the component will be re-rendered.</li>
<li><strong>In an instance variable</strong>: The variable will persist for the full lifetime of the component. Changes in an instance variable won’t generate a re-render.</li>
</ul>
<hr />
<p>In functional components this would be;</p>
<ul>
<li><strong>In a state variable</strong>: <code>useState</code> or <code>useReducer</code>. Updates in state variables will cause a re-render of the component.</li>
<li><strong>In a ref:</strong> Equivalent to instance variables in class components. Mutating the <code>.current</code> property won’t cause a re-render.</li>
</ul>
<h2 id="4-updating-ref">4. Updating Ref</h2>
<p>Updating a ref variable is a side effect therefore needs to be done inside <strong>useEffect or useLayoutEffect</strong></p>
<p>In React all side effect should be inside Layout Phase.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631558833135/z0sKhd9U7.png" alt="React Lifecycle" /></p>
<pre><code class="lang-jsx"><span class="hljs-keyword">import</span> React, { useRef } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> RenderCounter = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> counter = useRef(<span class="hljs-number">0</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-comment">// Every time the component has been re-rendered,</span>
    <span class="hljs-comment">// the counter is incremented</span>
    counter.current = counter.current + <span class="hljs-number">1</span>;
  }); 

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>{`The component has been re-rendered ${counter} times`}<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span></span>
  );
};
</code></pre>
<h2 id="5-summary">5. Summary</h2>
<p>The useRef Hook lets us create mutable variables inside functional components.</p>
<p>There are three main key points that you should keep in mind when using the useRef Hook;</p>
<ul>
<li>A ref created with useRef will be created only when the component <strong>has been mounted</strong> and preserved for the full lifecycle.</li>
<li>Refs can be used for accessing DOM nodes or React elements, and for storing mutable variables (like with instance variables in class components).</li>
<li><strong>Updating a ref is a side effect</strong> so it should be done only inside a <strong>useEffect (or useLayoutEffect) or inside an event handler.</strong></li>
</ul>
<h2 id="links">Links</h2>
<ul>
<li><p><a target="_blank" href="https://reactjs.org/docs/hooks-reference.html#useref">Hooks API Reference - React</a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/trabe/react-useref-hook-b6c9d39e2022">React useRef Hook</a></p>
</li>
<li><p><a target="_blank" href="https://dmitripavlutin.com/react-useref-guide/">The Complete Guide to useRef() and Refs in React</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[How to Built
Accessible Web Apps]]></title><description><![CDATA[In this article we will take a look how to built accessible web apps. 
Table of Contents

Semantic HTML
Keyboard Accessible
Tab Order
Tab Index
Using Native Elements
Guideline for Custom Elements
Screen Readers
Labels and Aria Attributes
Use Librarie...]]></description><link>https://blog.furkanozbek.com/how-to-built-accessible-web-apps</link><guid isPermaLink="true">https://blog.furkanozbek.com/how-to-built-accessible-web-apps</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Sat, 11 Sep 2021 13:25:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366781260/DRGMFeHNE.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article we will take a look how to built accessible web apps. </p>
<h2 id="table-of-contents">Table of Contents</h2>
<ol>
<li>Semantic HTML</li>
<li>Keyboard Accessible</li>
<li>Tab Order</li>
<li>Tab Index</li>
<li>Using Native Elements</li>
<li>Guideline for Custom Elements</li>
<li>Screen Readers</li>
<li>Labels and Aria Attributes</li>
<li>Use Libraries and polyfills</li>
</ol>
<h2 id="1-semantic-html">1. Semantic HTML</h2>
<p>HTML (Hyper Text Markup Language) is exactly that: a markup language. This means that it is not only plain text, but text marked up with meaning - so called "semantics". For this, HTML offers a lot of tags, each with an inherent, unique semantic meaning. And it is absolutely crucial that those tags are used properly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366768851/-Lq4JSNq8.jpeg" alt="Semantic HTML" /></p>
<h3 id="11-tags-with-no-meanings">1.1. Tags with No Meanings</h3>
<p>To understand the importance of proper semantics, let's first look at the exceptions: tags that indeed do not provide semantical information.</p>
<p>There are only two tags in HTML that do not have any semantic meaning: <code>&lt;div&gt;</code> and <code>&lt;span&gt;</code>. Their purpose is to offer containers needed for visual styling. And their only difference is that <code>&lt;div&gt;</code> is a <strong>block element</strong>, while <code>&lt;span&gt;</code> is an <strong>inline element</strong>.</p>
<h3 id="12-tags-with-meanings">1.2. Tags with Meanings</h3>
<p>Content elements are used to give meaning to content (like headings, paragraphs, or links). Marking up text using an <code>&lt;h#&gt;</code> tag tells the user agent that this is not just plain text, but - in fact - a heading of a certain level!</p>
<p>Structural elements are used to group elements on a webpage, separating them into different regions (like <strong>header, navigation, main, or footer</strong>). They have been introduced in HTML 5.</p>
<h2 id="2-keyboard-accessible">2. Keyboard accessible</h2>
<p><strong>All the interactive elements of your page</strong> e.g. text boxes, buttons etc should be accessible by keyboard. That means you should be able to bring focus on them by using <strong>Tab and Shift+Tab</strong> keys.</p>
<ul>
<li>Most of the interactive elements are keyboard accessible by default, i.e. browser takes care of making them keyboard ‘focus-able’.</li>
<li>Non interactive elements like div, span and images are not keyboard accessibly by default. This is fine because users don’t generally need to interact with them.</li>
</ul>
<h2 id="3-tab-order">3. Tab Order</h2>
<p>‌The order in which elements get focus is called tab-order. Developers need to take care that the interactive elements have logical tab-order. Tab order should follow the natural reading sequence i.e. top to bottom and right to left (for an <strong>RTL type language</strong>). If your tab focus is jumping around the page unpredictably then its not going to be great experience for the users.</p>
<p>Tab-order mainly depends on the <strong>dom-order,</strong> i.e. the way you have written your html. Any element which is ahead in the dom tree automatically goes ahead in the tab-order.</p>
<p>Sometimes people use css to make the element appear in an order which is different form dom-order. </p>
<p>For Example;</p>
<pre><code class="lang-html"><span class="hljs-comment">&lt;!-- This will mess the tab-order. So no no! --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"float:right;"</span>&gt;</span>Right aligned link<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#"</span>&gt;</span>Link 1<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#"</span>&gt;</span>Link 2<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>‌
</code></pre>
<h2 id="4-tab-index">4. Tab Index</h2>
<p>Recommended Usage <strong>0 for tab accessible</strong> and <strong>-1 for tab unaccessible</strong></p>
<ul>
<li>To make a non interactive element focusable you can give it <code>tabindex="0"</code> attribute. This not only makes the element <strong>tab accessible</strong> but also makes it programmatically <strong>focusable</strong>. That means you can call <strong>.focus()</strong> on that element.</li>
<li><code>tabindex="-1"</code> will take out any interactive element from tab-order. That means you can not access it through keyboard. This is particularly useful when you want to make few links/buttons inaccessible when they are behind an overlay or transitioned out of display (e.g. hamburger menus)</li>
<li>Positive tabindex value makes the element tab accessible and also puts the element ahead in tab-order based on the value of the attribute. But positive tabindex values are considered anti-pattern becuase it may get very confusing more than one elements have positive tabindex values. So, <strong>don’t</strong> <strong>use</strong> positive tabindex.</li>
</ul>
<h3 id="41-inert-library">4.1. Inert Library</h3>
<p><strong>INERT</strong> is a javascript library which makes part of the application focusable or unfocusable. Under the hood it adds <code>tabindex="0"</code> or <code>tabindex="-1"</code> to the element.</p>
<ul>
<li><a target="_blank" href="https://github.com/WICG/inert/blob/master/src/inert.js">inert/inert.js at master · WICG/inert</a></li>
</ul>
<h2 id="5-use-native-elements">5. Use native elements</h2>
<ul>
<li>As far as possible please use native elements for any specific purpose. That means, for example, if you need a button then just use button tag rather than making a button using divs or spans.</li>
<li>Native interactive elements like buttons, select boxes etc have many built in accessibility features which you might miss if you are creating your own.</li>
</ul>
<h3 id="51-native-form-elements">5.1. Native Form Elements</h3>
<ul>
<li><a target="_blank" href="http://nativeformelements.com/">Native Form Elements</a></li>
</ul>
<h2 id="6-guideline-for-custom-elements">6. Guideline for custom elements</h2>
<ul>
<li>If you must create a custom element then make sure that you go through the wai-aria best practices guide: <a target="_blank" href="https://www.w3.org/TR/wai-aria-practices-1.1/">WAI-ARIA Authoring Practices 1.1</a></li>
<li>These guidelines tell you how the keyboard interactions should be for any element. It also has links to demo and code examples for our help.</li>
</ul>
<p><a target="_blank" href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/button/button.html">Button Examples</a></p>
<h2 id="7-screen-readers">7. Screen readers</h2>
<p>Screen readers are applications that will tell what is the current state of application. ...</p>
<p>You should take care of this;</p>
<ul>
<li>Many users with visual impairment rely on assistive tools like screen readers to get information on the page and to interact with page</li>
<li>Always use <strong>alt attribute</strong> for images. Screen readers would read out the alt text for its users who have difficulty in seeing the image.</li>
<li>Use proper heading tags, etc for headings, because screen readers allow users to navigate within the content of page using headings.</li>
<li>Make efficient use of semantic tags like <code>&lt;header&gt;, &lt;footer&gt;, &lt;section&gt;, &lt;nav&gt;</code> etc because screen readers allow users to navigate within the content of page using these tags.</li>
<li>Screen readers need to identify the interactive elements correctly so it can ask users to interact with them. For example, if you have created a button using <code>&lt;button&gt;</code> tag then screen reader will call it out as button. But if your button is something like <code>&lt;div class="fancy button"&gt;Submit&lt;/div&gt;</code> then screen reader will call it a “<strong>group</strong>” because div is grouping element, and user would not understand that they are supposed to interact with that element.</li>
</ul>
<p><strong>How HTML elements are supported by screen readers</strong></p>
<ul>
<li><a target="_blank" href="https://thepaciellogroup.github.io/AT-browser-tests/?utm_source=html5weekly&amp;utm_medium=email">HTML test file indexthepaciellogroup.github.io</a></li>
</ul>
<h2 id="8-labels-and-aria-attributes">8. <strong>Labels and aria attributes</strong></h2>
<p>There are indeed situations where standard HTML <strong>does not</strong> provide functionalities for all the requirements developers may have for implementing modern and interactive websites. For this, the <em>Accessible Rich Internet Applications (ARIA)</em> technical specification was introduced.</p>
<ul>
<li>Any code written in html not only has a visual representation but also has a semantical representation called <em>accessibility tree</em>. Accessibility tree is used by assistive tools like <strong>screen readers</strong> to inform the user about the accessibility properties like <strong>type, name, state and value</strong> of the element. The values of these accessibility properties are computed by browser based on the information provided in <strong>html code</strong>.</li>
</ul>
<p>In above example name is computed by the tag. <strong>Make use of label tag wherever applicable.</strong></p>
<p>Use <strong>aria-label</strong> attribute to ensure that element has a name. Suppose you have a save button which does not have a text content, then browser will not be able to compute its name. We can mention aria-label attribute to help browser compute its name.</p>
<ul>
<li><p>Similarly use different aria attributes like role, <strong>aria-labelledby, aria-expanded, aria-checked (etc..)</strong> to help browser compute accessibility properties:</p>
</li>
<li><p><a target="_blank" href="https://www.w3.org/TR/wai-aria-practices-1.1/">WAI-ARIA Authoring Practices 1.1</a></p>
</li>
</ul>
<h2 id="9-use-libraries-and-polyfills">9. <strong>Use Libraries and polyfills</strong></h2>
<h3 id="91-axe">9.1. Axe</h3>
<ul>
<li><a target="_blank" href="https://chrome.google.com/webstore/detail/axe/lhdoppojpmngadmnindnejefpokejbdd">aXe</a> is an amazing tool to identify the accessibility gaps in your page. It is a chrome extension. Install it and use through chrome dev tools to analyse the accessibility of the page.</li>
<li>Use aXe to analyse colour contrast in your page. A bad colour contrast ratio will make it difficult for few users to read the text. aXe can point out the regions of your page where the contrast does not match the <a target="_blank" href="https://www.w3.org/TR/WCAG20/#visual-audio-contrast">WCAG guidelines</a>.</li>
</ul>
<h3 id="92-chrome-accessibility-inspector">9.2. Chrome Accessibility Inspector</h3>
<ul>
<li>Chrome has an experimental <a target="_blank" href="https://www.notion.so/0a42f815878c159517a55e6652e3b23a">accessibility inspector</a> in dev tools. Go to setting -&gt; experiments in chrome dev tools to enable it. This tool helps by letting you know the computed accessibility properties</li>
<li>If you want to automate the accessibility audit in your project, you can use <a target="_blank" href="https://github.com/dequelabs/axe-core">axe-core</a>. It is a node module which you can include in your build process.</li>
</ul>
<h3 id="93-focus-ring">9.3. Focus Ring</h3>
<p>Focus-ring is the outline which gets displayed around the control when it receives focus. At times, especially with buttons, these focus rings are not very aesthetically pleasant so developers tend to disable it in css (outline:none). Mouse users wouldn’t face any issues because of this but keyboard users find it problematic because can’t figure out whether the control has focus or not. Ideally focus ring should be visible to keyboard user even if it is invisible for mouse user. </p>
<p>Here is an awesome library;</p>
<ul>
<li><a target="_blank" href="https://github.com/WICG/focus-visible">GitHub - WICG/focus-visible: Polyfill for <code>:focus-visible</code></a></li>
</ul>
<h2 id="screenshots">Screenshots</h2>
<p><strong>vscode accessibility extention</strong>
<img src="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKboX_W41O5nFKb1m%2Fcode-accessibility-warning.jpg?alt=media&amp;token=17a66e7c-a8fa-4511-9acb-d312267e4ef2" alt="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366770612/-wpKva9Ub.jpeg" /></p>
<p><strong>Checking Accessibility With AXE</strong>
<img src="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsgfGXKuJcEVsLT6%2FScreen%20Shot%202019-12-09%20at%2009.18.02.png?alt=media&amp;token=a6a1f323-f67a-4df5-a714-62cc20bc5bd0" alt="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366772436/f2Xh32-RG.png" /></p>
<p><strong>Checking Accessibility With AXE-2</strong>
<img src="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsghqU1AWtwjFjtV%2FScreen%20Shot%202019-12-09%20at%2009.20.42.png?alt=media&amp;token=d0e87c6b-673f-4cf1-a628-7307b9948592" alt="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366774567/ttMZU4Ih2.png" /></p>
<p><strong>Checking Accessibility With Chrome Lighthouse</strong>
<img src="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsgiL_Km-sYCvpHA%2FScreen%20Shot%202019-12-09%20at%2009.21.51.png?alt=media&amp;token=b2542a0f-f047-4fd9-b5d8-96689089c766" alt="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366776810/jFb7vyRCR.png" /></p>
<p><strong>Checking Accessibility With Chrome Lighthouse-2</strong>
<img src="https://gblobscdn.gitbook.com/assets%2F-Lpw2alDrsVYpWGBqlF_%2F-LvdK87UfJANojIUa1DN%2F-LvdKsgjsO6871vaFsOP%2FScreen%20Shot%202019-12-09%20at%2009.22.23.png?alt=media&amp;token=43f698fa-3c72-480d-9d58-cfbfa4c748c0" alt="https://cdn.hashnode.com/res/hashnode/image/upload/v1631366778821/IyKi9o31h.png" />
‌</p>
<h2 id="resources-and-articles">Resources &amp; Articles</h2>
<ul>
<li><p><a target="_blank" href="https://www.w3.org/WAI/fundamentals/accessibility-intro/">Introduction to Web Accessibility</a></p>
</li>
<li><p><a target="_blank" href="https://frontendmasters.com/books/front-end-handbook/2019/#4.14">Front-end Developer Handbook 2019 - Learn the entire JavaScript, CSS and HTML development practice!</a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/@realabhijeet4u/9-tips-to-get-bare-minimum-of-web-accessibility-739899a9437c">9 tips to get bare minimum of web accessibility</a></p>
</li>
<li><p><a target="_blank" href="https://www.smashingmagazine.com/2019/06/web-accessibility-context/">Web Accessibility In Context - Smashing Magazine</a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/hackernoon/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2">Removing that ugly :focus ring (and keeping it too)</a></p>
</li>
<li><p><a target="_blank" href="https://24ways.org/2019/making-a-better-custom-select-element/">Making a Better Custom Select Element</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Who is Furkan Ozbek?]]></title><description><![CDATA[Furkan is a software engineer whose primary purpose is to create the best optimal experience for users and keep the application or project as performant as possible.
He loves working with a good team and loves to improve himself on web development. 
...]]></description><link>https://blog.furkanozbek.com/who-is-furkan-ozbek</link><guid isPermaLink="true">https://blog.furkanozbek.com/who-is-furkan-ozbek</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Sat, 11 Sep 2021 10:17:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631355396636/HPOVXJHk8.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Furkan is a software engineer whose primary purpose is to create the best optimal experience for users and keep the application or project as performant as possible.</p>
<p>He loves working with a good team and loves to improve himself on web development. </p>
<p>He especially likes working on front-end development because seeing what you have built always satisfies him. </p>
<hr />
<p>His most important experience would be building a complex transaction modal for blockchain. The challenge he experiences was he did not have enough experience in web3 and blockchain in general on the frontend. Because of this first, he thought he needed a plan for this.</p>
<p>So here how he manage to do it;</p>
<p><strong>1 - Define what the problems are</strong></p>
<p>In here, he first right down the issues he had, define which libraries he needs to be taking a look at, and even which state management library that he will gonna use (Redux, Context API, Mobx, etc.)</p>
<p><strong>2 - Create the Modal UI</strong></p>
<p>Then he thought it would be good practice to create the general UI for it</p>
<p><strong>3 - Prepare the Data From Store</strong></p>
<p>Here he will just define what will be the type of data stored in the context.</p>
<p><strong>4 - Test it with Dummy Data</strong></p>
<p>Here he will connect the test data with the UI he created</p>
<p><strong>5 - Connect it with the transaction</strong></p>
<p>Because feature needs to be worked on the transactions. Here he just chooses one transaction to let's say <strong>createUser</strong>, he will show the modal and show how much gas it costs, etc.</p>
<p><strong>6 - Finally with real data</strong></p>
<h2 id="in-the-final-step-he-tested-with-real-graphql-queries-and-mutations-and-he-saw-that-everything-is-working-correctly">In the final step, he tested with real <strong>Graphql queries and mutations</strong> and he saw that everything is working correctly</h2>
<p>Like this, he experienced a lot of different problems like this but he managed to fix the issues <strong>step by step</strong></p>
<p>Furkan quotes:</p>
<blockquote>
<p>Planning a job is like finishing half the job.</p>
</blockquote>
<hr />
<p>Right now he tries to share what he learned with platforms like Twitter, Linkedin, Dev.to, and hashcode. </p>
<h3 id="reference">Reference</h3>
<ul>
<li><a target="_blank" href="https://www.toptal.com/resume/philip-greenberg">Phil Greenberg on Toptal</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[6 Javascript Projects for Beginners]]></title><description><![CDATA[1 - Weather App
🔗 App Description
{% codepen https://codepen.io/tutsplus/pen/gObLaEP %}
2- Pomodoro Clock
🔗 App Description
🔗 Demo

3 - Calculator
🔗 App Description
{% codepen https://codepen.io/mjijackson/pen/xOzyGX %}
4 - Todo List
🔗 App Descr...]]></description><link>https://blog.furkanozbek.com/6-javascript-projects-for-beginners</link><guid isPermaLink="true">https://blog.furkanozbek.com/6-javascript-projects-for-beginners</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Fri, 10 Sep 2021 07:33:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631259353882/HRd3ETdZx.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-weather-app">1 - Weather App</h2>
<p>🔗 <a target="_blank" href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Weather-App.md">App Description</a></p>
<p>{% codepen https://codepen.io/tutsplus/pen/gObLaEP %}</p>
<h2 id="2-pomodoro-clock">2- Pomodoro Clock</h2>
<p>🔗 <a target="_blank" href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Pomodoro-Clock.md">App Description</a></p>
<p>🔗 <a target="_blank" href="https://pomo.furkanozbek.com/">Demo</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631259347721/uSmL5SLpS.png" alt="Pomodoro Clock" /></p>
<h2 id="3-calculator">3 - Calculator</h2>
<p>🔗 <a target="_blank" href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Calculator-App.md">App Description</a></p>
<p>{% codepen https://codepen.io/mjijackson/pen/xOzyGX %}</p>
<h2 id="4-todo-list">4 - Todo List</h2>
<p>🔗 <a target="_blank" href="https://github.com/florinpop17/app-ideas/blob/master/Projects/2-Intermediate/To-Do-App.md">App Description</a>
🔗 <a target="_blank" href="https://todo.furkanozbek.com/">Demo</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631259349733/0PxTSyLet.png" alt="Todo App" /></p>
<h2 id="5-password-generator">5 - Password Generator</h2>
<p>🔗 <a target="_blank" href="https://github.com/florinpop17/app-ideas/blob/master/Projects/2-Intermediate/Password-Generator.md">App Description</a>
🔗 <a target="_blank" href="https://afozbek-password-generator.netlify.app/">Demo</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631259351621/-Cc3i3zcm.png" alt="Password Generator" /></p>
<h2 id="6-countdown-app">6 - Countdown App</h2>
<p>🔗 <a target="_blank" href="https://github.com/florinpop17/app-ideas/blob/master/Projects/1-Beginner/Countdown-Timer-App.md">App Description</a></p>
<p>{% codepen https://codepen.io/karlo-stekovic/pen/OajKVK %}</p>
<h2 id="links">Links</h2>
<ul>
<li><p><a target="_blank" href="https://dev.to/pauld103/javascript-coding-projects-for-beginners-3fj0">Best JavaScript coding projects for beginners! 👨🏻‍💻</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/florinpop17/app-ideas">GitHub - florinpop17/app-ideas: A Collection of application ideas which can be used to improve your coding skills.</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[What is Function Composition]]></title><description><![CDATA[1. What is Compose
In algebra, function composition allows you to apply one function to the output of another function. It looks like this;

We can also apply same thing with javascript.
const compose = (g, f) => x => g(f(x));

2. Example
I can tell,...]]></description><link>https://blog.furkanozbek.com/what-is-function-composition</link><guid isPermaLink="true">https://blog.furkanozbek.com/what-is-function-composition</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Thu, 09 Sep 2021 10:10:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631182282235/d-KU0ngyB.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-what-is-compose">1. What is Compose</h2>
<p><strong>In algebra</strong>, function composition allows you to apply one function to the output of another function. It looks like this;</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631182280110/3gKVaNA5X.png" alt="Compose Example" /></p>
<p>We can also apply same thing with javascript.</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> compose = <span class="hljs-function">(<span class="hljs-params">g, f</span>) =&gt;</span> <span class="hljs-function"><span class="hljs-params">x</span> =&gt;</span> g(f(x));
</code></pre>
<h2 id="2-example">2. Example</h2>
<p>I can tell, you are a little bit confused. Let me break it down for you;</p>
<p>Let’s say we want to get the name of a user and uppercase it. First of all, we have to write a function that extracts the name of the user;</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> user = {<span class="hljs-attr">name</span>: <span class="hljs-string">'Furkan'</span>, <span class="hljs-attr">lastName</span>: <span class="hljs-string">"Cool"</span>}
<span class="hljs-comment">// Returns -&gt; String</span>
<span class="hljs-keyword">const</span> getUserName = <span class="hljs-function">(<span class="hljs-params">user</span>) =&gt;</span> user.name
getUserName(user)
<span class="hljs-comment">// 'Furkan'</span>
</code></pre>
<p>And then a function that uppercases strings:</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// Accepts -&gt; String</span>
<span class="hljs-comment">// Returns -&gt; String</span>
<span class="hljs-keyword">const</span> upperCase = <span class="hljs-function">(<span class="hljs-params">string</span>) =&gt;</span> string.toUpperCase()
upperCase(<span class="hljs-string">'Furkan'</span>)
<span class="hljs-comment">// 'FURKAN'</span>
</code></pre>
<blockquote>
<p>Notice that one function's <strong>return value</strong> is other function's <strong>parameter type</strong>.</p>
</blockquote>
<hr />
<p>Compose function will return a function that will executes these two functions.</p>
<p>In our example they are: <code>getUsername</code> &amp; <code>upperCase</code></p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> compose = <span class="hljs-function">(<span class="hljs-params">G, F</span>) =&gt;</span> <span class="hljs-function"><span class="hljs-params">X</span> =&gt;</span> G(F(X));

<span class="hljs-comment">// 'X' in compose</span>
<span class="hljs-keyword">const</span> user = {<span class="hljs-attr">name</span>: <span class="hljs-string">'Furkan'</span>, <span class="hljs-attr">lastName</span>: <span class="hljs-string">"Cool"</span>}

<span class="hljs-comment">// 'F' in compose</span>
<span class="hljs-keyword">const</span> getUserName = <span class="hljs-function">(<span class="hljs-params">user</span>) =&gt;</span> user.name

<span class="hljs-comment">// 'G' in compose</span>
<span class="hljs-keyword">const</span> upperCase = <span class="hljs-function">(<span class="hljs-params">string</span>) =&gt;</span> string.toUpperCase()

<span class="hljs-comment">// Returned function in compose</span>
<span class="hljs-keyword">const</span> getUserNameAndUpperCase = compose(upperCase, getUserName)

<span class="hljs-comment">// user -&gt; 'X' in compose function</span>
getUserNameAndUpperCase(user); 
<span class="hljs-comment">//'FURKAN'</span>
</code></pre>
<h2 id="3-scale-problem">3. Scale Problem</h2>
<p>The problem with this implementation of compose() is that it takes as parameters just <strong>N</strong> functions (<code>upperCase</code> &amp; <code>getUserName</code>).</p>
<p>Let’s suppose we want to add another function that returns the full name of the user;</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> getUserFullName = <span class="hljs-function">(<span class="hljs-params">name</span>) =&gt;</span> name + <span class="hljs-string">" "</span> + user.lastName;
getUserFullName(‘FURKAN’);
<span class="hljs-comment">// 'FURKAN Cool'</span>
</code></pre>
<p>Did you see the problem here?</p>
<h2 id="4-using-compose-with-reduceright-function">4. Using compose with reduceRight function</h2>
<p>For this case instead of giving <strong>N</strong> functions and manually changing them, we can use the spread <code>syntax (...)</code> and give an array of functions as an argument to <strong>compose function</strong>.</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// reduceRight calls from right to left instead of left to right</span>
<span class="hljs-keyword">const</span> compose = <span class="hljs-function">(<span class="hljs-params">...fns</span>) =&gt;</span> <span class="hljs-function">(<span class="hljs-params">initialVal</span>) =&gt;</span> fns.reduceRight(<span class="hljs-function">(<span class="hljs-params">val, fn</span>) =&gt;</span> fn(val), initialVal);
</code></pre>
<blockquote>
<p>The <code>reduceRight()</code> method applies a function against an accumulator and each value of the array (<strong>from right-to-left</strong>) to reduce it to a single value.</p>
</blockquote>
<h2 id="5-full-example">5. Full Example</h2>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> compose = <span class="hljs-function">(<span class="hljs-params">...fns</span>) =&gt;</span> <span class="hljs-function">(<span class="hljs-params">initialVal</span>) =&gt;</span> {
  <span class="hljs-keyword">return</span> fns.reduceRight(<span class="hljs-function">(<span class="hljs-params">val, fn</span>) =&gt;</span> fn(val), initialVal)
};
<span class="hljs-keyword">const</span> user = { <span class="hljs-attr">name</span>: <span class="hljs-string">'Furkan'</span>, <span class="hljs-attr">lastName</span>: <span class="hljs-string">"Cool"</span> }
<span class="hljs-keyword">const</span> getUserName = <span class="hljs-function">(<span class="hljs-params">user</span>) =&gt;</span> user.name
<span class="hljs-keyword">const</span> upperCase = <span class="hljs-function">(<span class="hljs-params">string</span>) =&gt;</span> string.toUpperCase()
<span class="hljs-keyword">const</span> getUserFullName= <span class="hljs-function">(<span class="hljs-params">name</span>) =&gt;</span> name + <span class="hljs-string">" "</span> + user.lastName
compose(firstFour, upperCase, getUserFullName)(user);
<span class="hljs-comment">// 'FURKAN Cool'</span>
</code></pre>
<h2 id="conclusion">Conclusion</h2>
<p>Composition is really insteresting subject. Instead of unreadable nested functions, you can organize and chain your functions with each other. And it is super cool!</p>
<h2 id="links">Links</h2>
<ul>
<li><p>🔗 <a target="_blank" href="https://www.freecodecamp.org/news/function-composition-in-javascript/">Function Composition in JavaScript</a></p>
</li>
<li><p>🔗 <a target="_blank" href="https://betterprogramming.pub/compose-and-pipe-in-javascript-medium-d1e1b2b21f83">Compose and Pipe in JavaScript</a></p>
</li>
<li>🔗 <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/ReduceRight">Array.prototype.reduceRight() - JavaScript | MDN</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[8 Free Public APIs That you can use in side projects]]></title><description><![CDATA[1. The Open Movie Database (OMDb)
OMDb contains different kinds of movies that you can use in your projects. 

Auth: apiKey

Website: 🔗 OMDb


2. Pokemon API
You would probably remember these amazing creatures that can do awesome stuff. What happens...]]></description><link>https://blog.furkanozbek.com/8-free-public-apis-that-you-can-use-in-side-projects</link><guid isPermaLink="true">https://blog.furkanozbek.com/8-free-public-apis-that-you-can-use-in-side-projects</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Wed, 08 Sep 2021 10:08:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631095865466/W0ePLPX57.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="1-the-open-movie-database-omdb">1. The Open Movie Database (OMDb)</h3>
<p>OMDb contains different kinds of movies that you can use in your projects. </p>
<ul>
<li><p><strong>Auth:</strong> apiKey</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="https://www.omdbapi.com/">OMDb</a></p>
</li>
</ul>
<h3 id="2-pokemon-api">2. Pokemon API</h3>
<p>You would probably remember these amazing creatures that can do awesome stuff. What happens we can use them in our projects;</p>
<ul>
<li><p><strong>Auth:</strong> No</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="http://pokeapi.co/">PokéAPI</a></p>
</li>
</ul>
<h3 id="3-rick-and-morty-api">3. Rick &amp; Morty API</h3>
<p>These two characters really taught us something. Let us honor them by using inside projects.</p>
<ul>
<li><p><strong>Auth</strong>: No</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="http://rickandmortyapi.com/">The Rick and Morty API</a></p>
</li>
</ul>
<h3 id="4-nomics-cryptocurrency-and-bitcoin-api">4. Nomics Cryptocurrency &amp; Bitcoin API</h3>
<p>So you are interested in blockchain and want to build side projects with it. Nomic is the way to go.</p>
<ul>
<li><p><strong>Auth:</strong> apiKey</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="https://nomics.com/docs/">Nomics CryptoCurrent API</a></p>
</li>
</ul>
<h3 id="5-dicebear-avatar-api">5. DiceBear Avatar API</h3>
<p>If you want to generate unique, beautiful avatars you can check out diceBear's documentation.</p>
<ul>
<li><p><strong>Auth:</strong> No</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="https://avatars.dicebear.com/docs">Getting started | DiceBear Avatars</a></p>
</li>
</ul>
<h3 id="6-json-placeholder-api">6. Json Placeholder API</h3>
<p>This one is useful for filling some dummy test data to your application. It contains <code>/posts</code>, <code>/comments</code> queries that you can and it is completely free to use. Awesome!</p>
<ul>
<li><p><strong>Auth:</strong> No</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="http://jsonplaceholder.typicode.com/">JSONPlaceholder</a></p>
</li>
</ul>
<h3 id="7-new-york-times">7. New York Tİmes</h3>
<p>Get the latest news around the world quickly, smoothly.</p>
<ul>
<li><p><strong>Auth:</strong> apiKey</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="https://developer.nytimes.com">NYTimes API</a></p>
</li>
</ul>
<h3 id="8-fixer">8. Fixer</h3>
<p>See the current currency rate of exchange between different currencies.</p>
<ul>
<li><p><strong>Auth:</strong> apiKey</p>
</li>
<li><p><strong>Website:</strong> 🔗 <a target="_blank" href="https://fixer.io/">Foreign exchange rates and currency conversion API</a></p>
</li>
</ul>
<h2 id="links">Links</h2>
<ul>
<li><p><a target="_blank" href="https://dev.to/pascavld/10-free-public-apis-for-developers-you-need-to-use-for-your-next-projects-39i">10 Free Public APIs for developers you need to use for your next projects</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/public-apis/public-apis#weather">GitHub - public-apis/public-apis: A collective list of free APIs</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[How to flatten array using Javascript]]></title><description><![CDATA[Problem
So you have some nested array but need to flattened it so you use it inside your codebase. There are actually a couple of ways to do it.
Here is what we are gonna take a look at;

Array.prototype.flat()
Reduce and Concat Solution
Recursive So...]]></description><link>https://blog.furkanozbek.com/how-to-flatten-array-using-javascript</link><guid isPermaLink="true">https://blog.furkanozbek.com/how-to-flatten-array-using-javascript</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Tue, 07 Sep 2021 11:38:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631014780569/wbl_YsQ6q.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="problem">Problem</h2>
<p>So you have some nested array but need to flattened it so you use it inside your codebase. There are actually a couple of ways to do it.</p>
<p>Here is what we are gonna take a look at;</p>
<ul>
<li>Array.prototype.flat()</li>
<li>Reduce and Concat Solution</li>
<li>Recursive Solution</li>
<li>Stack Solution</li>
</ul>
<h2 id="1-arrayprototypeflat-solution">1. Array.prototype.flat() Solution</h2>
<p>The flat() method creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.</p>
<ul>
<li><strong>Returns:</strong> A new array with the sub-array elements concatenated into it.</li>
</ul>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> arr1 = [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]];

<span class="hljs-built_in">console</span>.log(arr1.flat());
<span class="hljs-comment">// expected output: [0, 1, 2, 3, 4]</span>

<span class="hljs-keyword">const</span> arr2 = [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, [[[<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]]]];

<span class="hljs-comment">// We can also give optional depth argument to flat function</span>
<span class="hljs-built_in">console</span>.log(arr2.flat(<span class="hljs-number">2</span>));
<span class="hljs-comment">// expected output: [0, 1, 2, [3, 4]]</span>
</code></pre>
<p>Flat can  also work on nested arrays</p>
<pre><code class="lang-jsx"><span class="hljs-built_in">console</span>.log(arr2.flat(<span class="hljs-literal">Infinity</span>))
<span class="hljs-comment">// expected output: [0, 1, 2, 3, 4]</span>
</code></pre>
<p>Or it can remove empty spots in the array</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> arr5 = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, , <span class="hljs-number">4</span>, <span class="hljs-number">5</span>];
arr5.flat();
<span class="hljs-comment">// [1, 2, 4, 5]</span>
</code></pre>
<h2 id="2-reduce-and-concat-solution">2. Reduce and Concat Solution</h2>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> flatten = <span class="hljs-function">(<span class="hljs-params">arr</span>) =&gt;</span> {
  <span class="hljs-keyword">return</span> arr.reduce(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">flat, toFlatten</span>) </span>{
    <span class="hljs-keyword">return</span> flat.concat(<span class="hljs-built_in">Array</span>.isArray(toFlatten) 
            ? 
            flatten(toFlatten) 
            : toFlatten);
  }, []);
}

flatten([[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], [<span class="hljs-number">4</span>, <span class="hljs-number">5</span>]]); <span class="hljs-comment">// [1, 2, 3, 4, 5]</span>
flatten([[[<span class="hljs-number">1</span>, [<span class="hljs-number">1.1</span>]], <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], [<span class="hljs-number">4</span>, <span class="hljs-number">5</span>]]); <span class="hljs-comment">// [1, 1.1, 2, 3, 4, 5]</span>
</code></pre>
<h2 id="3-recursive-solution">3. Recursive Solution</h2>
<p>We can also apply recursive solution with the help of concat function</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> flattenArray = <span class="hljs-function">(<span class="hljs-params">input</span>) =&gt;</span> {
  <span class="hljs-keyword">let</span> result = []

  <span class="hljs-keyword">if</span> (!<span class="hljs-built_in">Array</span>.isArray(input)){
    <span class="hljs-keyword">return</span> input
  }

  <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> data <span class="hljs-keyword">of</span> input) {
    result = result.concat(flattenArray(data))
  }

  <span class="hljs-keyword">return</span> result;
}

<span class="hljs-keyword">let</span> arr = [<span class="hljs-string">"a"</span>, <span class="hljs-number">0</span>, [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], <span class="hljs-number">3</span>, [[<span class="hljs-number">5</span>, <span class="hljs-number">6</span>], [[<span class="hljs-number">8</span>, <span class="hljs-number">9</span>]]]]

<span class="hljs-built_in">console</span>.log(flattenArray(arr))
<span class="hljs-comment">// ["a", 0, 1, 2, 3, 5, 6, 8, 9]</span>
</code></pre>
<h2 id="4-stack-solution">4. Stack Solution</h2>
<p>We can also solve this by the help of stack data structure</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// non recursive flatten deep using a stack</span>
<span class="hljs-comment">// note that depth control is hard/inefficient as we will need to tag EACH value with its own depth</span>
<span class="hljs-comment">// also possible w/o reversing on shift/unshift, but array OPs on the end tends to be faster</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">flatten</span>(<span class="hljs-params">input</span>) </span>{
  <span class="hljs-keyword">const</span> stack = [...input];
  <span class="hljs-keyword">const</span> res = [];
  <span class="hljs-keyword">while</span>(stack.length) {
    <span class="hljs-comment">// pop value from stack</span>
    <span class="hljs-keyword">const</span> next = stack.pop();
    <span class="hljs-keyword">if</span>(<span class="hljs-built_in">Array</span>.isArray(next)) {
      <span class="hljs-comment">// push back array items, won't modify the original input</span>
      stack.push(...next);
    } <span class="hljs-keyword">else</span> {
      res.push(next);
    }
  }
  <span class="hljs-comment">// reverse to restore input order</span>
  <span class="hljs-keyword">return</span> res.reverse();
}

<span class="hljs-keyword">const</span> arr = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, [<span class="hljs-number">5</span>, <span class="hljs-number">6</span>]]];
flatten(arr);
<span class="hljs-comment">// [1, 2, 3, 4, 5, 6]</span>
</code></pre>
<h2 id="links">Links</h2>
<ul>
<li><p><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat">Array.prototype.flat() - JavaScript | MDN</a></p>
</li>
<li><p><a target="_blank" href="https://dev.to/nandkk05/flatten-an-array-using-javascript-568l">Flatten an array using javascript</a></p>
</li>
<li><p><a target="_blank" href="https://stackoverflow.com/questions/10865025/merge-flatten-an-array-of-arrays">Merge/flatten an array of arrays</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[What is LocalStorage]]></title><description><![CDATA[1. Definition
The localStorage read-only property of the window interface allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions.
llocalStorage is similar to sessionStorage, except that while...]]></description><link>https://blog.furkanozbek.com/what-is-localstorage</link><guid isPermaLink="true">https://blog.furkanozbek.com/what-is-localstorage</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Mon, 06 Sep 2021 07:18:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630912828115/pM1oTmreN.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-definition">1. Definition</h2>
<p>The localStorage read-only property of the window interface allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions.</p>
<p>llocalStorage is similar to sessionStorage, except that while localStorage data has no expiration time, sessionStorage data gets cleared when the page session ends — that is, when the page is closed. (localStorage data for a document loaded in a "private browsing" or "incognito" session is cleared when the last "private" tab is closed.)</p>
<h2 id="2-data-format">2. Data Format</h2>
<p>The keys and the values stored with localStorage are always in the UTF-16 DOMString format, which uses two bytes per character. As with objects, integer keys are automatically converted to strings.</p>
<h2 id="3-example">3. Example</h2>
<pre><code class="lang-jsx"><span class="hljs-comment">// Setting and item: key: value</span>
<span class="hljs-built_in">localStorage</span>.setItem(<span class="hljs-string">'myCat'</span>, <span class="hljs-string">'Tom'</span>);

<span class="hljs-comment">// Reading an item</span>
<span class="hljs-keyword">const</span> cat = <span class="hljs-built_in">localStorage</span>.getItem(<span class="hljs-string">'myCat'</span>);

<span class="hljs-comment">// Remove an item</span>
<span class="hljs-built_in">localStorage</span>.removeItem(<span class="hljs-string">'myCat'</span>);

<span class="hljs-comment">// Clear all items</span>
<span class="hljs-built_in">localStorage</span>.clear();
</code></pre>
<p>{% codepen https://codepen.io/moghaazi/pen/BajWgav %}</p>
<h2 id="4-advaced-examples">4. Advaced Examples</h2>
<p>For setting objects or dates we need to convert to strings because localStorage only store string format</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">let</span> userList = [{<span class="hljs-attr">name</span>: <span class="hljs-string">"David"</span>}, {<span class="hljs-attr">name</span>: <span class="hljs-string">"Kevin"</span>}]
<span class="hljs-keyword">let</span> date = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>()

<span class="hljs-comment">// Setting</span>
<span class="hljs-built_in">localStorage</span>.setItem(<span class="hljs-string">"userList"</span>, <span class="hljs-built_in">JSON</span>.stringify(userList))
<span class="hljs-built_in">localStorage</span>.setItem(<span class="hljs-string">"date"</span>, date.toString())

<span class="hljs-comment">// Reading</span>
userList = <span class="hljs-built_in">JSON</span>.parse(<span class="hljs-built_in">localStorage</span>.getItem(<span class="hljs-string">"userList"</span>))
date = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>(<span class="hljs-built_in">localStorage</span>.getItem(<span class="hljs-string">"date"</span>))
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630912826567/-iw1vu8Mj.png" alt="Screenshot of localstorage" /></p>
<h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage">Mozilla Docs</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[React Hooks: useMemo]]></title><description><![CDATA[1. Problem
In the lifecycle of a component, React re-renders the component when an update is made. When React checks for any changes in a component, it may detect an unintended or unexpected change due to how JavaScript handles equality and shallow c...]]></description><link>https://blog.furkanozbek.com/react-hooks-usememo</link><guid isPermaLink="true">https://blog.furkanozbek.com/react-hooks-usememo</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Sun, 05 Sep 2021 08:15:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630829768513/RZEOZiIkC.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-problem">1. Problem</h2>
<p>In the lifecycle of a component, React re-renders the component when an update is made. When React checks for any changes in a component, it may detect an unintended or unexpected change due to how JavaScript handles equality and shallow comparisons. This change in the React application will cause it to re-render unnecessarily.</p>
<p>{% codesandbox jjxypyk86w %}</p>
<blockquote>
<p><strong>If one part re-renders, it re-renders the entire component tree.</strong></p>
</blockquote>
<h2 id="2-memoization">2. Memoization</h2>
<p>Memoization or memoisation is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again.</p>
<p>If we have a function compute <code>1 + 1</code>, it will return <code>2</code>. But if it uses memoization, the next time we run <code>1</code>’s through the function, it won’t add them up; it will just remember the answer is <code>2</code> without executing the adding function.</p>
<h2 id="3-syntax">3. Syntax</h2>
<p>From the <a target="_blank" href="https://reactjs.org/docs/hooks-reference.html#usememo">official React documentation</a>, syntax is looking like this;</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> memoizedValue = useMemo(<span class="hljs-function">() =&gt;</span> computeExpensiveValue(a, b), [a, b]);
</code></pre>
<p>useMemo takes in a function and an array of dependencies.</p>
<p>useMemo hook will run the expensive operation when one of the dependencies has been changed. If no changes has been made it will return stored value.</p>
<h2 id="4-example">4. Example</h2>
<p>Here is an example of useMemo in action. </p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> memoizedList = useMemo(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> userList.map(<span class="hljs-function"><span class="hljs-params">user</span> =&gt;</span> {
    <span class="hljs-keyword">return</span> {
      ...user,
      <span class="hljs-attr">name</span>: someExpensiveOperation(user.name)
    } 
  }) 
}, [userList])
</code></pre>
<h2 id="5-use-right-hook">5. Use right hook</h2>
<p>In addition to <strong>useMemo</strong>, there is also <strong>useCallback</strong> and <strong>useEffect</strong> which can be used similar situations</p>
<p>The useCallback hook is similar to useMemo, but it returns a <strong>memoized function</strong> rather than <strong>memoized value</strong>.</p>
<p>If your dependencies array is not provided, there is no possibility of memoization, and it will compute a new value on every render. So in this reason you can go ahead with <strong>useEffect</strong></p>
<pre><code class="lang-jsx"><span class="hljs-comment">// useMemo - returns -&gt; memoized value</span>
<span class="hljs-keyword">const</span> memoizedValue = useMemo(<span class="hljs-function">() =&gt;</span> expensiveFunction(a,b), [a,b])

<span class="hljs-comment">// useCallback - returns -&gt; memoized function</span>
<span class="hljs-keyword">const</span> memoizedCallback = useCallback(<span class="hljs-function">() =&gt;</span> {
    doSomething(a, b);
  },
  [a, b]
);
</code></pre>
<h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://reactjs.org/docs/hooks-reference.html#usememo">Hooks API Reference - React</a></li>
<li><a target="_blank" href="https://www.digitalocean.com/community/tutorials/react-usememo">Understanding the React useMemo Hook | DigitalOcean</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[7 Useful Projects on Github for Web Developers]]></title><description><![CDATA[1. FreeCodeCamp
Build projects to earn free certificates and get experience by coding for nonprofits. 
You can learn pretty much anything related to programming. If you are type of person who tries to follow video tutorials then you can take a look t...]]></description><link>https://blog.furkanozbek.com/7-useful-projects-on-github-for-web-developers</link><guid isPermaLink="true">https://blog.furkanozbek.com/7-useful-projects-on-github-for-web-developers</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Sat, 04 Sep 2021 10:56:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630753032193/Wmjjl7g9t.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-freecodecamp">1. FreeCodeCamp</h2>
<p>Build projects to earn free certificates and get experience by coding for nonprofits. </p>
<p>You can learn pretty much anything related to programming. If you are type of person who tries to follow video tutorials then you can take a look their youtube channel.</p>
<p><a target="_blank" href="github.com/freeCodeCamp/freeCodeCamp"><strong>Github</strong></a>
<a target="_blank" href="youtube.com/c/Freecodecamp"><strong>Youtube</strong></a></p>
<h2 id="2-free-programming-books">2. Free Programming Books</h2>
<p>his repository shares free programming books that you can read. It contains all kinds of topics. Definitely check that out if you are interested. (Don't forget to give it a star 😅)</p>
<p><a target="_blank" href="github.com/EbookFoundation/free-programming-books"><strong>Github</strong></a></p>
<h2 id="3-bootstrap">3. Bootstrap</h2>
<p>Undoubtedly the most popular HTML, CSS and JavaScript framework for developing responsive, mobile first projects on the web.</p>
<p><a target="_blank" href="github.com/twbs/bootstrap"><strong>Github</strong></a></p>
<h2 id="4-awesome-lists">4. Awesome Lists</h2>
<p>This repository contains detailed lists around any topics. You can found out what you like or you can contribute that you think others would be interested.</p>
<p><a target="_blank" href="github.com/sindresorhus/awesome"><strong>Github</strong></a></p>
<h2 id="5-you-dont-know-js">5. You Don't Know JS</h2>
<p>A series of books diving deep into the core mechanisms of the JavaScript language. The first edition of the series is now complete. You can buy it in print, or read online for free!</p>
<p><a target="_blank" href="github.com/getify/You-Dont-Know-JS"><strong>Github</strong></a></p>
<h2 id="6-coding-interview-university">6. Coding Interview University</h2>
<p>So you have big interview coming up or you just want to be prepared. Then this project covers you.</p>
<p>It contains links, tutorials, stories that author experienced, advices...</p>
<p>Definitely stop by if you have some time.</p>
<p><a target="_blank" href="github.com/jwasham/coding-interview-university"><strong>Github</strong></a></p>
<h2 id="7-developer-roadmap">7. Developer Roadmap</h2>
<p>I keep my favorite one to the last.</p>
<p>This repository will show you what skills or path you need to take in order to fulfill your developer path. </p>
<p>Of course you do not need to complete all of them but it gives good idea what you need to do. So you can create a list and take a look at the process you made.</p>
<p><a target="_blank" href="github.com/kamranahmedse/developer-roadmap"><strong>Github</strong></a></p>
<h2 id="helpful-links-and-resources">Helpful Links &amp; Resources</h2>
<ul>
<li><a target="_blank" href="https://github.com/freeCodeCamp/freeCodeCamp">freeCodeCamp</a></li>
<li><a target="_blank" href="https://github.com/EbookFoundation/free-programming-books">Free Programming Books</a></li>
<li><a target="_blank" href="https://github.com/twbs/bootstrap">Bootstrap</a></li>
<li><a target="_blank" href="https://github.com/sindresorhus/awesome">Awesome</a></li>
<li><a target="_blank" href="https://github.com/getify/You-Dont-Know-JS">You-Dont-Know-JS</a></li>
<li><a target="_blank" href="https://github.com/jwasham/coding-interview-university">Coding Interview University</a></li>
<li><a target="_blank" href="https://github.com/kamranahmedse/developer-roadmap">Developer roadmap - 2020</a></li>
<li><a target="_blank" href="https://www.attosol.com/top-50-projects-on-github-2020/">Top 50 Projects on Github - 2020</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[4 Tips to work on your side project while working full-time]]></title><description><![CDATA[1. Create Time Boundaries
I can not stress enough how import it is to create time boundaries between your work hours and your personal time.
I made some strict rules about work hours for the company I worked on and stick to that plan to free up my pe...]]></description><link>https://blog.furkanozbek.com/4-tips-to-work-on-your-side-project-while-working-full-time</link><guid isPermaLink="true">https://blog.furkanozbek.com/4-tips-to-work-on-your-side-project-while-working-full-time</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Fri, 03 Sep 2021 08:44:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630658874355/Xosab8_TR.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-create-time-boundaries">1. Create Time Boundaries</h2>
<p>I can not stress enough how import it is to create time boundaries between your work hours and your personal time.</p>
<p>I made some strict rules about work hours for the company I worked on and stick to that plan to free up my personal time.</p>
<p>I saw the differences very shortly afterwards.</p>
<h2 id="2-set-small-goals">2. Set Small Goals</h2>
<p>Set small goals every day/week. Divide that goals into parts where they will not look so big and try to achieve them.</p>
<p>Try to reward yourself once you achieve your goal. This will keep you motivated and happy.</p>
<h2 id="3-keeping-it-consistent">3. Keeping it Consistent</h2>
<p>Progress is progress even if it 10 minutes, 30 minutes. So no mather how small your contibution it will still be counted.</p>
<p>So try to understand what is best for you and how much can you spend in that week.  Even it is a small amount do not see it as not worth it.</p>
<p>Small but consistent efforts are definitely going to pay out for you. It may take some time, but you will definitely see the results.</p>
<h2 id="4-dont-be-a-perfectionist">4. Don't be a perfectionist</h2>
<p>Being a perfectionist will cause you to spend more time, think more time and stress more time on small things. Always remember, you will have enough time to improve it later than making it perfect now!</p>
<p>Believe me I've been there, I've been done that.</p>
<hr />
<p>It is hard to focus on side projects especially if you have a full time job. But once you start to free up some of your time, you will see the differences. </p>
<h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://dev.to/ms_yogii/5-tips-to-work-on-your-side-project-while-working-full-time-n7i">5 Tips to work on your side project while working full-time.</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[5 Common Data Structures]]></title><description><![CDATA[1. Arrays
Array is collection of elements which can be identified with array index 
Each data element is assigned a positive numerical value called the Index*,* which corresponds to the position of that item in the array. The majority of languages de...]]></description><link>https://blog.furkanozbek.com/5-common-data-structures</link><guid isPermaLink="true">https://blog.furkanozbek.com/5-common-data-structures</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Thu, 02 Sep 2021 09:31:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630575154889/f52ewdmxN.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-arrays">1. Arrays</h2>
<p>Array is collection of elements which can be identified with array index </p>
<p>Each data element is assigned a positive numerical value called the <strong>Index*</strong>,* which corresponds to the position of that item in the array. The majority of languages define the starting index of the array as 0. </p>
<p>The following are the two types of arrays:</p>
<ul>
<li>One-dimensional arrays</li>
<li>Multi-dimensional arrays</li>
</ul>
<pre><code class="lang-jsx"><span class="hljs-keyword">let</span> arr = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

arr[<span class="hljs-number">1</span>] <span class="hljs-comment">// 2</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630575111055/aspwuzidO.png" alt="array" /></p>
<h2 id="2-stacks">2. Stacks</h2>
<p>Stacks are abstract data types that holds an ordered, linear sequence of items.</p>
<p>In contrast to a queue, a stack is a last in, first out (LIFO) structure.</p>
<p>A Real life example of stack could be a pile of books placed in vertical order which in order to take first book in the stack you need to remove all of the top ones. </p>
<p>This is called Last <strong>LIFO (Last in First Out)</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630575113665/RVQhe4Mi1.jpeg" alt="Pile of Books" /></p>
<h2 id="3-queues">3. Queues</h2>
<p>Similar to Stack, Queue is another linear data structure that stores the element in a sequential manner.</p>
<p>The only significant difference between Stack and Queue is that instead of using the LIFO method, Queue implements the FIFO  method.</p>
<p>LIFO -&gt; Last In First Out (Stack)
FIFO -&gt; First In First Out (Queue)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630575115988/sWZDU9umY.jpeg" alt="Queue" /></p>
<h2 id="4-linked-lists">4. Linked Lists</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630575118040/i6olN4qaT.png" alt="Linked List" /></p>
<p>A linked list is another important linear data structure which might look similar to arrays at first but differs in memory allocation, internal structure and how basic operations of insertion and deletion are carried out. </p>
<p>Each item in the linked list called nodes that contain a reference to the next node in the list. </p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> linkedList = {
    <span class="hljs-comment">// head of the linked list</span>
    <span class="hljs-attr">head</span>: {
        <span class="hljs-attr">value</span>: <span class="hljs-number">6</span>
        <span class="hljs-attr">next</span>: {
            <span class="hljs-attr">value</span>: <span class="hljs-number">10</span>                                             
            <span class="hljs-attr">next</span>: {
                <span class="hljs-attr">value</span>: <span class="hljs-number">12</span>
                <span class="hljs-attr">next</span>: {
                    <span class="hljs-attr">value</span>: <span class="hljs-number">3</span>
                    <span class="hljs-comment">//    Last value points -&gt; null                            </span>
                    <span class="hljs-attr">next</span>: <span class="hljs-literal">null</span>    
                  }
                }
            }
        }
    }
};
</code></pre>
<p>First let us create the node class of the linked list</p>
<pre><code class="lang-jsx"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ListNode</span> </span>{
    <span class="hljs-keyword">constructor</span>(data) {
        <span class="hljs-built_in">this</span>.data = data
        <span class="hljs-built_in">this</span>.next = <span class="hljs-literal">null</span>                
    }
}
</code></pre>
<p>Then we can create linkedList which takes a node as an argument.</p>
<pre><code class="lang-jsx"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LinkedList</span> </span>{
    <span class="hljs-keyword">constructor</span>(head = null) {
        <span class="hljs-built_in">this</span>.head = head
    }
}
</code></pre>
<pre><code class="lang-jsx"><span class="hljs-keyword">let</span> node1 = <span class="hljs-keyword">new</span> ListNode(<span class="hljs-number">2</span>)
<span class="hljs-keyword">let</span> node2 = <span class="hljs-keyword">new</span> ListNode(<span class="hljs-number">5</span>)
node1.next = node2

<span class="hljs-keyword">let</span> list = <span class="hljs-keyword">new</span> LinkedList(node1)

<span class="hljs-built_in">console</span>.log(list.head.next.data) <span class="hljs-comment">//returns 5</span>
</code></pre>
<h2 id="5-hash-tables-objects-or-dictionaries">5. Hash Tables (Objects | Dictionaries)</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630575119775/u5tcUpSwK.png" alt="Hash Table" /></p>
<p>Hashing is a process used to uniquely identify objects and store each object at some pre-calculated unique index called its "key"</p>
<p>So, the object is stored in the form of a "key-value" pair, and the collection of such items is called a "dictionary."</p>
<p>Each object can be searched using that key. There are different data structures based on hashing, but the most commonly used data structure is the "hash table".</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> collection = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Map</span>();

collection.set(<span class="hljs-string">"Nathan"</span>, <span class="hljs-string">"555-0182"</span>);
collection[<span class="hljs-string">"size"</span>] = <span class="hljs-literal">false</span>;

<span class="hljs-built_in">console</span>.log(collection.get(<span class="hljs-string">"size"</span>)); <span class="hljs-comment">// undefined</span>
<span class="hljs-built_in">console</span>.log(collection.size); <span class="hljs-comment">// 1</span>
</code></pre>
<h3 id="51-filter-out-duplicate-items">5.1. Filter out duplicate items</h3>
<pre><code class="lang-jsx">
<span class="hljs-keyword">let</span> items = [<span class="hljs-string">"apple"</span>, <span class="hljs-string">"pear"</span>, <span class="hljs-string">"orange"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"apple"</span>,
         <span class="hljs-string">"orange"</span>, <span class="hljs-string">"apple"</span>, <span class="hljs-string">"pear"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"orange"</span>,
         <span class="hljs-string">"apple"</span>, <span class="hljs-string">"kiwi"</span>, <span class="hljs-string">"pear"</span>, <span class="hljs-string">"apple"</span>, <span class="hljs-string">"orange"</span>]

<span class="hljs-keyword">let</span> set = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Set</span>([<span class="hljs-string">"apple"</span>, <span class="hljs-string">"pear"</span>, <span class="hljs-string">"orange"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"apple"</span>,
         <span class="hljs-string">"orange"</span>, <span class="hljs-string">"apple"</span>, <span class="hljs-string">"pear"</span>, <span class="hljs-string">"banana"</span>, <span class="hljs-string">"orange"</span>,
         <span class="hljs-string">"apple"</span>, <span class="hljs-string">"kiwi"</span>, <span class="hljs-string">"pear"</span>, <span class="hljs-string">"apple"</span>, <span class="hljs-string">"orange"</span>])

<span class="hljs-built_in">console</span>.log(set)
<span class="hljs-comment">// Set(5) {"apple", "pear", "orange", "banana", "kiwi"}</span>
</code></pre>
<h2 id="helpful-links-and-resources">Helpful Links &amp; Resources</h2>
<ul>
<li><a target="_blank" href="https://dev.to/highcenburg/common-data-structures-1fh">4 Common Data Structures</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/the-top-data-structures-you-should-know-for-your-next-coding-interview-36af0831f5e3/">The top data structures you should know for your next coding interview</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/implementing-a-linked-list-in-javascript/">How to Implement a Linked List in JavaScript</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[3 Ways to set default values]]></title><description><![CDATA[1. Variables
The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined and otherwise returns its left-hand side operand. We can use this to set default val...]]></description><link>https://blog.furkanozbek.com/3-ways-to-set-default-values</link><guid isPermaLink="true">https://blog.furkanozbek.com/3-ways-to-set-default-values</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Wed, 01 Sep 2021 06:58:47 GMT</pubDate><content:encoded><![CDATA[<h3 id="1-variables">1. Variables</h3>
<p>The <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator">nullish coalescing operator (<code>??</code>)</a> is a logical operator that returns its right-hand side operand when its left-hand side operand is <code>null</code> or <code>undefined</code> and otherwise returns its left-hand side operand. We can use this to set default values, for example when we receive a list that has not been set to an array yet:</p>
<pre><code><span class="hljs-keyword">const</span> bookList = receivedBooks ?? [];
</code></pre><h3 id="2-parameters">2. Parameters</h3>
<p>We could use the <em>null coalescing operator</em> to set defaults for variables in functions but there is a better way, <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default parameters</a>:</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">calculateArea</span>(<span class="hljs-params">width, height = <span class="hljs-number">100</span></span>) </span>{
    <span class="hljs-keyword">return</span> width * height;
}

<span class="hljs-keyword">const</span> area = calculateArea(<span class="hljs-number">50</span>);
<span class="hljs-built_in">console</span>.log(area); <span class="hljs-comment">// 5000</span>
</code></pre><h3 id="3-objects">3. Objects</h3>
<p>We can also give default value once we destructure object properties. ES6 destructuring default values only kick in if the value is <code>undefined</code>.</p>
<pre><code>const rectangle = { height: <span class="hljs-number">400</span> };
const { height = <span class="hljs-number">750</span>, width = <span class="hljs-number">500</span> } = rectangle;
console.log(height); // <span class="hljs-number">400</span> - comes <span class="hljs-keyword">from</span> rectangle <span class="hljs-keyword">object</span>
console.log(width);  // <span class="hljs-number">500</span> - fallback <span class="hljs-keyword">to</span> <span class="hljs-keyword">default</span>
</code></pre><h2 id="links">Links</h2>
<ul>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator">nullish coalescing operator (<code>??</code>)</a></li>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">default parameters</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[8 Javascript Tips  That You Should Know]]></title><description><![CDATA[1. Number<>String
For converting numbers and strings with each other, we can use following methods;
// Number > String
let num = 4
let newNum = num.toString();

// String > Number
let num = "4"
let stringNumber = Number(num);

// New Way
let num = 15...]]></description><link>https://blog.furkanozbek.com/8-javascript-tips-that-you-should-know</link><guid isPermaLink="true">https://blog.furkanozbek.com/8-javascript-tips-that-you-should-know</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Tue, 31 Aug 2021 10:02:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630404388955/-US4fP-sF.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-numberlessgreaterstring">1. Number&lt;&gt;String</h2>
<p>For converting numbers and strings with each other, we can use following methods;</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// Number &gt; String</span>
<span class="hljs-keyword">let</span> num = <span class="hljs-number">4</span>
<span class="hljs-keyword">let</span> newNum = num.toString();

<span class="hljs-comment">// String &gt; Number</span>
<span class="hljs-keyword">let</span> num = <span class="hljs-string">"4"</span>
<span class="hljs-keyword">let</span> stringNumber = <span class="hljs-built_in">Number</span>(num);

<span class="hljs-comment">// New Way</span>
<span class="hljs-keyword">let</span> num = <span class="hljs-number">15</span>;
<span class="hljs-keyword">let</span> numString = num + <span class="hljs-string">""</span>; <span class="hljs-comment">// number to string</span>
<span class="hljs-keyword">let</span> stringNum = +s; <span class="hljs-comment">// string to number</span>
</code></pre>
<h2 id="2-swap-using-destructuring">2. Swap using destructuring</h2>
<p>The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.</p>
<p> We can also use that to swap values fast, like this:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">let</span> a = <span class="hljs-number">1</span>, b = <span class="hljs-number">2</span>
[a, b] = [b, a]
<span class="hljs-built_in">console</span>.log(a) <span class="hljs-comment">// result -&gt; 2</span>
<span class="hljs-built_in">console</span>.log(b) <span class="hljs-comment">// result -&gt; 1</span>
</code></pre>
<h2 id="3-remove-duplicates-from-an-array">3. Remove duplicates from an Array</h2>
<p>If we have an array of values and we try to filter unique values we can follow this trick;</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> arr = [<span class="hljs-string">"1"</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-string">"abc"</span>, <span class="hljs-string">"1"</span>, <span class="hljs-number">2</span>, <span class="hljs-number">5</span>]
<span class="hljs-keyword">const</span> arrayWithUniqueItems = [...new <span class="hljs-built_in">Set</span>(arr)]
<span class="hljs-comment">// ["1", 2, 3, "abc", 5]</span>
</code></pre>
<h2 id="4-shorten-the-array-using-length">4. Shorten the array using length</h2>
<p>Array has length property which tells how many items inside that list.</p>
<p>If we change the length property the remaining items will be gone forever;</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">let</span> array = [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">6</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>]
array.length <span class="hljs-comment">// 10</span>
array.length = <span class="hljs-number">4</span>

<span class="hljs-comment">// Result: [0, 1, 2, 3]</span>
</code></pre>
<h2 id="5-combine-objects-using-spread">5. Combine objects using ...spread</h2>
<p>Let’s say you want to combine multiple objects into one object containing them all. The spread operator ( … ) is a great way to achieve this!</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> obj1 = {<span class="hljs-string">'a'</span>: <span class="hljs-number">1</span>, <span class="hljs-string">'b'</span>: <span class="hljs-number">2</span>}
<span class="hljs-keyword">const</span> obj2 = {<span class="hljs-string">'c'</span>: <span class="hljs-number">3</span>}
<span class="hljs-keyword">const</span> obj3 = {<span class="hljs-string">'d'</span>: <span class="hljs-number">4</span>}

<span class="hljs-comment">// Combine them using the spread operator            </span>
<span class="hljs-keyword">const</span> objCombined = {...obj1, ...obj2, ...obj3}

<span class="hljs-comment">// Result: {'a': 1, 'b': 2, 'c': 3, 'd': 4}</span>
</code></pre>
<h2 id="6-windowlocation-object">6. window.location object</h2>
<p>JavaScript can access the current URL using the window.location object. 
And it has all kinds of useful property which we can use;</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// JavaScript can access the current URL in parts. For this URL:</span>
<span class="hljs-string">`https://furkanozbek.com/example/index.html?s=article`</span>

<span class="hljs-built_in">window</span>.location.protocol == <span class="hljs-string">`https:`</span>
<span class="hljs-built_in">window</span>.location.host == <span class="hljs-string">`furkanozbek.com`</span>
<span class="hljs-built_in">window</span>.location.pathname == <span class="hljs-string">`/example/index.html`</span>
<span class="hljs-built_in">window</span>.location.search == <span class="hljs-string">`?s=article`</span>
</code></pre>
<h2 id="7-dynamice-object-properties">7. Dynamice Object Properties</h2>
<p>ES6 brought us computed property names that allow property keys of object literals to use expressions. </p>
<p>By surrounding the key with brackets [], we can use variables as property keys.</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> type = <span class="hljs-string">"fruit"</span>;
<span class="hljs-keyword">const</span> item = {
  [type]: <span class="hljs-string">"kiwi"</span>
};

<span class="hljs-built_in">console</span>.log(item); <span class="hljs-comment">// {fruit: "kiwi"}</span>

item[type];   <span class="hljs-comment">// "kiwi"</span>
item[<span class="hljs-string">"fruit"</span>] <span class="hljs-comment">// "kiwi"</span>

<span class="hljs-comment">// Or</span>
item.fruit <span class="hljs-comment">// "kiwi"</span>
</code></pre>
<h2 id="8-map-substitute">8. map() Substitute</h2>
<p>We can also use Array.from() method as the same way map function.</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">let</span> dogs = [
    { <span class="hljs-attr">name</span>: <span class="hljs-string">"Rio"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">2</span> },
    { <span class="hljs-attr">name</span>: <span class="hljs-string">"Mac"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">3</span> },
    { <span class="hljs-attr">name</span>: <span class="hljs-string">"Bruno"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">5</span> },
    { <span class="hljs-attr">name</span>: <span class="hljs-string">"Jucas"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">10</span> },
    { <span class="hljs-attr">name</span>: <span class="hljs-string">"Furr"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">8</span> },
    { <span class="hljs-attr">name</span>: <span class="hljs-string">"Blu"</span>, <span class="hljs-attr">age</span>: <span class="hljs-number">7</span> },
]

<span class="hljs-keyword">let</span> dogsNames = <span class="hljs-built_in">Array</span>.from(dogs, <span class="hljs-function">(<span class="hljs-params">{name}</span>) =&gt;</span> name);
<span class="hljs-comment">// returns [“Rio”, “Mac”, “Bruno”, “Jucas”, “Furr”, “Blu”]</span>
</code></pre>
<h2 id="links">Links</h2>
<ul>
<li><p><a target="_blank" href="https://modernweb.com/45-javascript-tips-tricks-practices/">45 Useful JavaScript Tips, Tricks And Best Practices | Modern Web</a></p>
</li>
<li><p><a target="_blank" href="https://dev.to/toktoktwan/5-must-know-javascript-tips-tricks-3pm7">5 Must-know Javascript Tips &amp; Tricks</a></p>
</li>
<li><p><a target="_blank" href="https://dev.to/worldindev/8-javascript-tips-tricks-that-no-one-teaches-24g1">8 JavaScript Tips &amp; Tricks That No One Teaches 🚀</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[4 custom react hooks that will make your development easier]]></title><description><![CDATA[1. useToggle
Basically, what this hook does is that, it takes a parameter with value true or false and toggles that value to opposite. It's useful when we want to take some action into it's opposite action.
For example; 

show and hide modal, 
show m...]]></description><link>https://blog.furkanozbek.com/4-custom-react-hooks-that-will-make-your-development-easier</link><guid isPermaLink="true">https://blog.furkanozbek.com/4-custom-react-hooks-that-will-make-your-development-easier</guid><dc:creator><![CDATA[Abdullah Furkan Özbek]]></dc:creator><pubDate>Mon, 30 Aug 2021 10:49:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630320628721/pdwQBKe5U.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-usetoggle">1. useToggle</h2>
<p>Basically, what this hook does is that, it takes a parameter with value true or false and toggles that value to opposite. It's useful when we want to take some action into it's opposite action.</p>
<p><strong>For example;</strong> </p>
<ul>
<li>show and hide modal, </li>
<li>show more/show less text, </li>
<li>open/close side menu.</li>
</ul>
<pre><code class="lang-jsx"><span class="hljs-comment">// Hook</span>
<span class="hljs-comment">// Parameter is the boolean, with default "false" value</span>
<span class="hljs-keyword">const</span> useToggle = <span class="hljs-function">(<span class="hljs-params">initialState = <span class="hljs-literal">false</span></span>) =&gt;</span> {
    <span class="hljs-comment">// Initialize the state</span>
    <span class="hljs-keyword">const</span> [state, setState] = useState(initialState);

    <span class="hljs-comment">// Define and memorize toggler function in case we pass down the comopnent,</span>
    <span class="hljs-comment">// This function change the boolean value to it's opposite value</span>
    <span class="hljs-keyword">const</span> toggle = useCallback(<span class="hljs-function">() =&gt;</span> setState(<span class="hljs-function"><span class="hljs-params">state</span> =&gt;</span> !state), []);

    <span class="hljs-keyword">return</span> [state, toggle]
}

<span class="hljs-comment">// Usage</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// Call the hook which returns, current value and the toggler function</span>
    <span class="hljs-keyword">const</span> [isTextChanged, setIsTextChanged] = useToggle();

    <span class="hljs-keyword">return</span> (
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{setIsTextChanged}</span>&gt;</span>
                {isTextChanged ? 'Toggled' : 'Click to Toggle'}
            <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
    );
}
</code></pre>
<h2 id="2-useonclickoutside">2. useOnClickOutside</h2>
<p>This hook allows you to detect clicks outside of a specified element. </p>
<p>By abstracting this logic out into a hook we can easily use it across all of our components that need this kind of functionality.</p>
<p><strong>For Example;</strong></p>
<ul>
<li>dropdown menus,</li>
<li>tooltips,</li>
<li>modals</li>
<li>etc..</li>
</ul>
<pre><code class="lang-jsx"><span class="hljs-comment">// Hook</span>
<span class="hljs-keyword">const</span> useOnClickOutside = <span class="hljs-function">(<span class="hljs-params">ref, handler</span>) =&gt;</span> {
  useEffect(
    <span class="hljs-function">() =&gt;</span> {
      <span class="hljs-keyword">const</span> listener = <span class="hljs-function">(<span class="hljs-params">event</span>) =&gt;</span> {
        <span class="hljs-comment">// Do nothing if clicking ref's element or descendent elements</span>
        <span class="hljs-keyword">if</span> (!ref.current || ref.current.contains(event.target)) {
          <span class="hljs-keyword">return</span>;
        }
        handler(event);
      };
      <span class="hljs-built_in">document</span>.addEventListener(<span class="hljs-string">"mousedown"</span>, listener);
      <span class="hljs-built_in">document</span>.addEventListener(<span class="hljs-string">"touchstart"</span>, listener);
      <span class="hljs-keyword">return</span> <span class="hljs-function">() =&gt;</span> {
        <span class="hljs-built_in">document</span>.removeEventListener(<span class="hljs-string">"mousedown"</span>, listener);
        <span class="hljs-built_in">document</span>.removeEventListener(<span class="hljs-string">"touchstart"</span>, listener);
      };
    },

    [ref, handler]
  );
}
</code></pre>
<pre><code class="lang-jsx"><span class="hljs-comment">// Usage</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-comment">// Create a ref that we add to the element for which we want to detect outside clicks</span>
  <span class="hljs-keyword">const</span> ref = useRef();
  <span class="hljs-comment">// State for our modal</span>
  <span class="hljs-keyword">const</span> [isModalOpen, setModalOpen] = useState(<span class="hljs-literal">false</span>);
  <span class="hljs-comment">// Call hook passing in the ref and a function to call on outside click</span>
  useOnClickOutside(ref, <span class="hljs-function">() =&gt;</span> setModalOpen(<span class="hljs-literal">false</span>));
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      {isModalOpen ? (
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">{ref}</span>&gt;</span>
          👋 Hey, I'm a modal. Click anywhere outside of me to close.
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      ) : (
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> setModalOpen(true)}&gt;Open Modal<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      )}
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
}
</code></pre>
<h2 id="3-usesubmit">3. useSubmit</h2>
<p>Instead of recreating  loading and form states we can also move that logic inside a hook called useSubmit</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// Hook</span>
<span class="hljs-keyword">const</span> useSubmit = <span class="hljs-function"><span class="hljs-params">submitFunction</span> =&gt;</span> {
  <span class="hljs-keyword">const</span> [loading, setLoading] = useState(<span class="hljs-literal">false</span>);
  <span class="hljs-keyword">const</span> [error, setError] = useState(<span class="hljs-literal">null</span>);

    <span class="hljs-keyword">const</span> handleSubmit = <span class="hljs-keyword">async</span> () =&gt; {
    <span class="hljs-keyword">try</span> {
      setLoading(<span class="hljs-literal">true</span>);
      setError(<span class="hljs-literal">null</span>);
      <span class="hljs-keyword">await</span> submitFunction();
    } <span class="hljs-keyword">catch</span> (error) {
      setError(error);
    } <span class="hljs-keyword">finally</span> {
      setLoading(<span class="hljs-literal">false</span>);
    }
  };

  <span class="hljs-keyword">return</span> [handleSubmit, loading, error];
};
</code></pre>
<pre><code class="lang-jsx"><span class="hljs-comment">// Usage</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">const</span> mySubmitFunction = <span class="hljs-function">() =&gt;</span> {
      <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve, reject</span>) =&gt;</span> {
        <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
                resolve(<span class="hljs-string">"Timeout Finished"</span>)
        }, <span class="hljs-number">2000</span>);
      });
    };
    <span class="hljs-keyword">const</span> [handleSubmit, loading, error] = useSubmit(mySubmitFunction);

    <span class="hljs-keyword">return</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"App"</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{handleSubmit}</span> <span class="hljs-attr">disabled</span>=<span class="hljs-string">{loading}</span>&gt;</span>
            {!loading ? "Click me" : "Loading..."}
          <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
          {error &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>{error}<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>}
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
      );
}
</code></pre>
<h2 id="4-usemediaquery">4. useMediaQuery</h2>
<p>If you want to write css in js or you just want to add some sideEffect to the specific device or breakpoint this hook is for you.</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// Hook</span>
<span class="hljs-keyword">const</span> useMediaQuery = (query = <span class="hljs-string">"(min-width: 576px)"</span>) =&gt; {
  <span class="hljs-keyword">const</span> [matches, setMatches] = useState(<span class="hljs-literal">false</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">const</span> media = <span class="hljs-built_in">window</span>.matchMedia(query);
    <span class="hljs-keyword">if</span> (media.matches !== matches) {
      setMatches(media.matches);
    }
    <span class="hljs-keyword">const</span> listener = <span class="hljs-function">() =&gt;</span> {
      setMatches(media.matches);
    };
    media.addListener(listener);
    <span class="hljs-keyword">return</span> <span class="hljs-function">() =&gt;</span> media.removeListener(listener);
  }, [matches, query]);

  <span class="hljs-keyword">return</span> matches;
}

<span class="hljs-comment">// Usage</span>
<span class="hljs-keyword">const</span> isTablet = useMediaQuery(<span class="hljs-string">"(max-width: 1200px)"</span>);
</code></pre>
<h2 id="links">Links</h2>
<ul>
<li><p><a target="_blank" href="https://usehooks.com/">useHooks</a></p>
</li>
<li><p><a target="_blank" href="https://usehooks-typescript.com/">useHooks(🔥).ts</a></p>
</li>
<li><p><a target="_blank" href="https://www.30secondsofcode.org/">30 seconds of code</a></p>
</li>
<li><p><a target="_blank" href="https://stackoverflow.com/questions/39501289/in-reactjs-how-to-copy-text-to-clipboard">In reactJS, how to copy text to clipboard?</a></p>
</li>
</ul>
]]></content:encoded></item></channel></rss>