<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sena Akbulut on Medium]]></title>
        <description><![CDATA[Stories by Sena Akbulut on Medium]]></description>
        <link>https://medium.com/@senaakbulut?source=rss-e4e506c7b3d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sYwareEbreLiMIehjpOrpQ.jpeg</url>
            <title>Stories by Sena Akbulut on Medium</title>
            <link>https://medium.com/@senaakbulut?source=rss-e4e506c7b3d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 20:12:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@senaakbulut/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Vue Js Lifecycle Hooks]]></title>
            <link>https://medium.com/cnk-tech/vue-js-lifecycle-hooks-b940ad06606d?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b940ad06606d</guid>
            <category><![CDATA[lifecycle]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Mon, 15 Jan 2024 12:45:18 GMT</pubDate>
            <atom:updated>2024-01-15T13:03:00.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DD3vSWElXsllzv5YgExXNA.png" /></figure><p>Hello everyone, I will tell you about Vue Js Lifecycle and lifecycle hooks. Every system has a life cycle. It is created, updated, and finally exited from that cycle. Vue Js also has a lifecycle and there are hooks to connect to these lifecycles and run functions there, these are lifecycle hooks.</p><p>These hooks can be shown in the diagram as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuPF9Iep5TpjcfNEfxcouA.png" /></figure><p>I will tell you about the hooks used in Composition API. These are:</p><h3>🪝onBeforeMount()</h3><p>The onBeforeMount hook occurs just before the component is mounted to the DOM. The onBeforeMount lifecycle hook happens right before the onMounted hook.</p><p>Type:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528201%252C210%252C225%252C0%2529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520onBeforeMount%2528callback%25253A%252520%2528%2529%252520%25253D%25253E%252520void%2529%25253A%252520void&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528201%25252C210%25252C225%25252C0%252529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520onBeforeMount%252528callback%2525253A%25252520%252528%252529%25252520%2525253D%2525253E%25252520void%252529%2525253A%25252520void&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8b0c8f7bc9c933d40b31a0f6896cda1/href">https://medium.com/media/e8b0c8f7bc9c933d40b31a0f6896cda1/href</a></iframe><h3>🪝onMounted()</h3><p>The onMounted hook is the function that will be called when the component is added to the DOM.</p><p>Type:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528201%252C210%252C225%252C0%2529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520onMounted%2528callback%25253A%252520%2528%2529%252520%25253D%25253E%252520void%2529%25253A%252520void&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528201%25252C210%25252C225%25252C0%252529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520onMounted%252528callback%2525253A%25252520%252528%252529%25252520%2525253D%2525253E%25252520void%252529%2525253A%25252520void&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fbc936fa5542e815ec5e52646ff3ffd/href">https://medium.com/media/2fbc936fa5542e815ec5e52646ff3ffd/href</a></iframe><h3>🪝onBeforeUpdate()</h3><p>The onBeforeUpdate hook is called whenever there is a change in the data of a component, but before the update is rendered to the screen. The onBeforeUpdate lifecycle hook happens right before the onUpdated hook.</p><p>Type:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528201%252C210%252C225%252C0%2529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520onBeforeUpdate%2528callback%25253A%252520%2528%2529%252520%25253D%25253E%252520void%2529%25253A%252520void&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528201%25252C210%25252C225%25252C0%252529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520onBeforeUpdate%252528callback%2525253A%25252520%252528%252529%25252520%2525253D%2525253E%25252520void%252529%2525253A%25252520void&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7ce5fe0f67c40ecfb128ad2c5485c03/href">https://medium.com/media/d7ce5fe0f67c40ecfb128ad2c5485c03/href</a></iframe><h3>🪝onUpdated()</h3><p>The onUpdated hook is called when the component updates the Dom tree.</p><p><strong>Note:</strong> This hook is called after any DOM update of the component, which can be caused by different state changes because multiple state changes can be batched into a single render cycle for performance reasons. If you need to access the updated DOM after a specific state change, use <a href="https://vuejs.org/api/general#nexttick"><strong>nextTick()</strong></a> instead. (<a href="https://vuejs.org/api/composition-api-lifecycle">https://vuejs.org/api/composition-api-lifecycle</a>)</p><p>Type:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528201%252C210%252C225%252C0%2529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520onUpdated%2528callback%25253A%252520%2528%2529%252520%25253D%25253E%252520void%2529%25253A%252520void&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528201%25252C210%25252C225%25252C0%252529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520onUpdated%252528callback%2525253A%25252520%252528%252529%25252520%2525253D%2525253E%25252520void%252529%2525253A%25252520void&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/aecba1df08a8d28f2d1aca37f0ce92ac/href">https://medium.com/media/aecba1df08a8d28f2d1aca37f0ce92ac/href</a></iframe><h3>🪝onBeforeUnmount()</h3><p>The onBeforeUnmount lifecycle hook is called just before a component is removed from the DOM.</p><p>When this hook is called, the component instance is still fully functional.</p><p>Type:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528201%252C210%252C225%252C0%2529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520onBeforeUnmount%2528callback%25253A%252520%2528%2529%252520%25253D%25253E%252520void%2529%25253A%252520void&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528201%25252C210%25252C225%25252C0%252529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520onBeforeUnmount%252528callback%2525253A%25252520%252528%252529%25252520%2525253D%2525253E%25252520void%252529%2525253A%25252520void&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1a05425027b2127c74f0f43e56fad86/href">https://medium.com/media/b1a05425027b2127c74f0f43e56fad86/href</a></iframe><h3>🪝onUnmounted()</h3><p>Registers a callback to be called after the component has been unmounted.</p><p>This hook can for example be used to remove event listeners or cancelling timers or intervals.</p><p>Type:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528201%252C210%252C225%252C0%2529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520onUnmounted%2528callback%25253A%252520%2528%2529%252520%25253D%25253E%252520void%2529%25253A%252520void&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528201%25252C210%25252C225%25252C0%252529%26t%3Dblackboard%26wt%3Dnone%26l%3Djavascript%26width%3D685%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dfalse%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520onUnmounted%252528callback%2525253A%25252520%252528%252529%25252520%2525253D%2525253E%25252520void%252529%2525253A%25252520void&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ff0456c7bb7f72ad07913d2f8994b42/href">https://medium.com/media/6ff0456c7bb7f72ad07913d2f8994b42/href</a></iframe><p>I can add this as a note. These hooks are not called during server-side rendering.</p><p>In general, these are the hooks and features for Composition API, I hope this was useful to you.</p><p>See you in the next writing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b940ad06606d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/vue-js-lifecycle-hooks-b940ad06606d">Vue Js Lifecycle Hooks</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Context API and useContext]]></title>
            <link>https://medium.com/cnk-tech/context-api-and-usecontext-51dc94f15af3?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/51dc94f15af3</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[context]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 14:29:03 GMT</pubDate>
            <atom:updated>2022-12-13T14:29:03.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwZ38Gr9x5FshhZ26iaedw.png" /></figure><p>Hello everyone, you may have heard of the Context API and the useContext hook separately many times. I will actually tell you the relationship and usage of these two definitions.</p><p>Firstly, <strong>Why you should use Context API</strong>?</p><p>You know that in React, props are passed to pass information from parent component to child component. But in a multi-component and complex related system, it becomes increasingly difficult to pass props. Because it needs to go through the components in between. This is called <strong><em>prop drilling</em></strong>.</p><p>The Context API is used to eliminate this problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXRlMJI6HT9WBCfnqzcbBw.png" /></figure><p>For example, in this flow chart, when there is without Context API, it is necessary to pass the prop through the userProfile.js file in between, but when the Context API is used, it can be used directly in the file to be used without visiting the file or files in between.</p><p>So what steps do you need to perform to use it?</p><ol><li>Create a context</li><li>Use that context from the component that needs the data.</li><li>Provide that context from the component that specifies the data.</li></ol><h4>Create a context</h4><p>First, you will create a context and export it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JTYWdJuNGv-CMUJjYq2c4A.png" /></figure><p>You can use default value as an argument in createContext.</p><h4>Use the context</h4><p>Suppose you have a component that takes level and children.</p><p>To use context in this component, we need to define the useContext hook and our own defined context.</p><p>This is where the useContext hook comes into play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMIGJWNdatMwmCHBzM5LfA.png" /></figure><p>The component to be used at the beginning was like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aShu0Hft1IfRC4_zh8lJFQ.png" /></figure><p>When the context imported:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hMnxnhmPOPeWkTnUAA8Rg.png" /></figure><p>In this way, since we define the level value as context, we can call it wherever we want.</p><p>🔗 <strong>useContext</strong> hook tells React that the LevelComponent component wants to read the LevelContext.</p><h4>Provide the context</h4><p>The Provider component helps wrap the components which have access to our context.</p><p>The Provider component receives a prop called “value,”, which can be accessed from all the components wrapped inside the Provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZNMKyAlaZlSYmzdYR_ADqw.png" /></figure><p>That’s it! You saw the Context API writing style and where the useContext hook is used.</p><p>Generally, the Context API is used in these operations:</p><ul><li>Authentication</li><li>Theming</li><li>Responsiveness</li><li>User profile management</li></ul><p>I hope I have informed you enough about Context API and useContext. See you in my next post.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fi67uIY4a61ejm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fi67uIY4a61ejm%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fi67uIY4a61ejm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/7bdb31d793f43e157ebefabc90048359/href">https://medium.com/media/7bdb31d793f43e157ebefabc90048359/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51dc94f15af3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/context-api-and-usecontext-51dc94f15af3">Context API and useContext</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Hooks]]></title>
            <link>https://medium.com/cnk-tech/react-hooks-f3759319e8b4?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3759319e8b4</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[hooks]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Fri, 09 Dec 2022 15:39:59 GMT</pubDate>
            <atom:updated>2022-12-09T15:39:59.143Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GrH6P_BJ10DdckmGWOOA_g.jpeg" /></figure><p>Hi everyone, today I will tell about the most used React hooks. First of all, what does hooks mean? let’s look at this.</p><p>Hooks were added to React in 16.8 version. It allows you to use state and other React features without writing class. Hooks are the functions which <em>hook into</em> React state and lifecycle features from function components. It does not work inside classes.</p><p>Alright, what are the hooks rules? There are 3 rules for hooks:</p><ul><li>Hooks can only be called inside React function components.</li><li>Hooks can only be called at the top level of a component.</li><li>Hooks cannot be conditional</li></ul><p>Now that we have general information about React hooks, we can look at their types.</p><ul><li>useState Hook</li><li>useEffect Hook</li><li>useRef Hook</li><li>useCallback Hook</li><li>useMemo Hook</li><li>useContext Hook</li><li>useReducer Hook</li></ul><h3>🪝<strong>UseState Hook</strong></h3><p>The useState hook allows you to create state variables in React function component. In this way, you access and update certain values in components over time.</p><p>When we create a state variable, we must provide it a default value.</p><p>Below is a simple example where you can update the color state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*0TVr0O1kfEQVAo3QFYVRDg.png" /></figure><p>It is defined in [ ] with a const prefix, the first value is the changed or retained value and access is provided by this value. The second value is the state function, the state value is changed with this function, usually starts with “set”. On the other side of the equation are the useState function and its first value.</p><p>You can update the state with functions that update it, in this example, I updated it with onClick.</p><h3>🪝UseEffect Hook</h3><p>The useEffect hook allows you perform side effects in your component. Some examples of side effects are, fetching data, directly update the DOM and timers.</p><p>Let’s use a timer as an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*K0vD1-K_OV6ZJcvPxfUqEQ.png" /></figure><p>When I do this way it will running continuously but I want it to run 1 time so I need to second parameter for useEffect.</p><pre>useEffect(() =&gt; {<br>  //Runs only on the first render<br>}, []);</pre><p>Final version with correct spelling:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*5quzz62-4iZyEuGw8bXlSA.png" /></figure><h3>🪝UseRef Hook</h3><p>Refs are special attribute that are available on all React components. They allow you to create a reference to given element/component when the component mounts.</p><p>useRef allows us to use React refs. They are helpful when we want to directly interact with an element, such as to clear its value or focus it, as with an input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*SaR2Q6TvoInbc2cIjZVvbg.png" /></figure><h3>🪝UseCallback Hook</h3><p>The useCallback hook returns a memoized callback function. Memoization is caching a value so that it does not need to be recalculated. This allows us to isolate resource intensive functions so that they will not automatically run on every render. The useCallback hook only runs when one of its dependencies update and this can improve performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*3hubE5GJrFXu9LCJ26xZzQ.png" /></figure><p>Using this way it won’t be rendered again when it doesn’t change.</p><h3>🪝UseMemo Hook</h3><p>The useMemo hook returns a memoized value. UseMemo hook to memoize the <em>expensiveCalculation</em> function and the useMemo hook only runs when one of its dependencies update. This can improve performance.</p><p>useMemo returns a value from the computation, which is then stored in a variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gT2_9BqIREnT6MaKUUb57Q.png" /></figure><h3>🪝UseContext Hook</h3><p>In React, there are multiple prop requirement problems to pass data from one parent to two or more levels, and this is called <em>prop drilling</em>.</p><p>Context is helpful for passing props down multiple levels of child components from a parent component and sharing state across your app component tree. The useContext hook removes the unusual-looking render props pattern that was required in consuming React Context before.</p><p>I will talk more about this hook in my next post.</p><h3>🪝UseReducer Hook</h3><p>The useReducer is a state management hook like useState. The difference is that useReducer allows custom state function. This function is also called <em>reducer</em>.</p><p>useReducer, more helpful for managing state across multiple components that may involve different operations or “actions”.</p><p>useReducer hook accepts two arguments:</p><blockquote>useReducer(&lt;reducer&gt;, &lt;initialState&gt;)</blockquote><p>The reducer function contains your custom state logic and the initialState can be a simple value but generally will contain an object.</p><p>The useReducer hook returns the current <em>state</em> and a <em>dispatch</em> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnn2tXk935dLxF7SN763wg.png" /></figure><p>I hope I have given enough information about hooks. In my next post, we will examine the useContext hook in more detail. See you 👋</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F1jkVi22T6iUrQJUNqk%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F1jkVi22T6iUrQJUNqk%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F1jkVi22T6iUrQJUNqk%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="428" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ff831551305c8d4aa92329d63a14cbb/href">https://medium.com/media/1ff831551305c8d4aa92329d63a14cbb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3759319e8b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/react-hooks-f3759319e8b4">React Hooks</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SASS & SCSS — PART 2]]></title>
            <link>https://medium.com/cnk-tech/sass-scss-part-2-8ff2ef0676d7?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ff2ef0676d7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 14:33:14 GMT</pubDate>
            <atom:updated>2021-09-02T14:33:14.415Z</atom:updated>
            <content:encoded><![CDATA[<h3>SASS &amp; SCSS — PART 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHeftFuj4mQx4ZIZBngMEQ.png" /></figure><p>Hello, I am here with the second part of the article on Sass and Scss. In this part, I will talk about the life-enhancing features of Sass and Scss.</p><p>Topics we will talk about in this part:</p><ul><li>Map - get</li><li>Nesting</li><li>Mixin</li><li>Function</li></ul><h4>💡 Map - get</h4><p>The map-get structure actually resembles the switch case. The defined variable can take more than one state and value, and we can assign the value we want from these states by specifying when using it.</p><p>To understand better, let’s look at an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ce49dcR_J3LrIqC3d_zHaQ.png" /></figure><p><strong>(SASS)</strong></p><p>Here, I defined three states named light, gray and dark for the color variable and assigned color values to these states.<br>Likewise, I assigned small, medium and big states to the size variable and specified the pixel values.<br>When I come to the sections to be used, when you specify it as <strong>map-get($state name, assigned value)</strong>, I will display in the CSS document that the value I have chosen is assigned.</p><p>❗️An important warning should be made for the Sass file: These situations must be defined side by side, it gives an error one after the other.</p><p><strong>(SCSS)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-GNLE2KvUAopimhvzsstQ.png" /></figure><p>In Scss, there is no obligation to write side by side, you can also make your definitions one under the other. It can be used in two ways as in the example. If you want, you can give the values directly, or you can use them by specifying that they are <strong>map</strong> and <strong>key</strong>.</p><h4>💡Nesting</h4><p>Rather than repeating the same selectors over and over again, you can write one style rules inside another. Sass will automatically combine the outer rule’s selector with the inner rule’s.</p><p><strong>(SASS)</strong></p><p>I mentioned in Sass that spaces are important. You can use spaces to indicate which element is below which element without repetition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HbPR8Yz1o2NddpjdXdtZNA.png" /></figure><p><strong>(SCSS)</strong></p><p>In scss, we use curly braces to indicate that they are children of each other. It is sufficient to add curly braces to cover the nested items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7F7vkoaJv2zHmD6K5jEeeA.png" /></figure><h4>💡Mixin</h4><p>Mixins allow you to define styles that can be re-used throughout your stylesheet. So you don’t have to repeat the same style elements over and over. Simply call the mixin you want to use with include.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGAI7qeO1uH2SJU2Ep_5sg.png" /></figure><p>First, we define the mixin, which includes recurring features, as <strong>@mixin mixinname</strong>. Then you can come to the box class you want to use and call it statically as <strong>@include mixinname.</strong><br>If you want, you can give parameters to the mixin to use it dynamically. Thus, you can make it easier to use by changing the color or size you want with the parameter.<br>If you want to define more than one parameter and call it with a single parameter, you must specify it while defining the mixin, otherwise, if you give the direct value, it will be based on the first parameter. If you do not want it to be based on the first parameter, you must call it with the name of the parameter you defined <strong>($height:1000px)</strong>. This time, if you do not define both parameters with <strong>:null</strong>, it will give an error because :null means that this parameter can also be empty.</p><p>Scss is also used in the same way, only the semicolon and curly brackets are different.</p><h4>💡Function</h4><p>Functions allow you to define complex operations on <a href="https://sass-lang.com/documentation/values">SassScript values</a> that you can re-use throughout your stylesheet. They make it easy to abstract out common formulas and behaviors in a readable way.</p><p>Operations such as for loop, if-else structure, mathematical operations can be used within functions. Returns a value with <strong>@return.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*exfWX88OF1V_IlNEKwAwow.png" /></figure><p>As in the example, the function is defined and the style element is added according to the return values and the value it is called.</p><p>Scss is also used in the same way.</p><p>We have come to the end of the second part of the Sass &amp; Scss article, I will talk about other topics in the next parts.<br>See you in the next parts 👋</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fi67uIY4a61ejm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fi67uIY4a61ejm%2Fgiphy.gif%3Fcid%3Decf05e47jv2geowmg7g6icqgwctb2sryrmu7k1u9vz0bx8dx%26rid%3Dgiphy.gif%26ct%3Dg&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fi67uIY4a61ejm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/3349ec09ae9ecac8c53d3f04678b3426/href">https://medium.com/media/3349ec09ae9ecac8c53d3f04678b3426/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ff2ef0676d7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/sass-scss-part-2-8ff2ef0676d7">SASS &amp; SCSS — PART 2</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SASS & SCSS — Part 1]]></title>
            <link>https://medium.com/cnk-tech/sass-and-scss-part-1-83e69e84247f?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/83e69e84247f</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Tue, 17 Aug 2021 17:26:46 GMT</pubDate>
            <atom:updated>2021-09-01T13:23:34.903Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*09pfe5KWt3xRonJfQ7dCSQ.jpeg" /></figure><p>Hello, in this article I will talk about Sass and Scss. Let’s first look at what Sass and Scss are, then let’s take a look at their features.</p><p>Topics we will talk about in this section:</p><ul><li>What is Sass?</li><li>What is Scss?</li><li>Install Sass</li><li>Converting Sass file to CSS file</li><li>Sass and Scss Spelling Rules</li><li>Variables in Sass and Scss</li></ul><h4>💡 What is Sass?</h4><p>Sass (Syntactically Awesome Stylesheets) is a CSS preprocessor. In other words, we can say that CSS is translated into the programming language.</p><p>It is there to avoid confusion and repetition that occurs when long CSS codes are written. It compiles the codes written with the logic of the programming language and converts them to CSS codes.</p><h4>💡 What is Scss?</h4><p>The difference between Scss and Sass is the syntax difference. What are these syntaxes? Curly braces and semicolons. It is preferable for those who cannot switch directly from CSS to Sass. In short, we can say that it is the version of Sass that is closer to CSS.</p><p>Now that we have learned what Sass and Scss are for, let’s look at how to install them.</p><h4>💡 <strong>Install Sass</strong></h4><p>For installation, you will see that there are various installation paths from Sass’s site <a href="https://sass-lang.com/install">https://sass-lang.com/install</a>. For this, the application can be downloaded and used, it can also be used by installing from the terminal. I prefer to install via npm. The code you need to type in the terminal is as follows:</p><pre>npm install -g sass</pre><p>In this way, you include the Sass and Scss structure in your project.</p><h4>💡 Converting Sass file to CSS file</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mbFvaJ-Dk2aKeo2nCsRbsw.png" /></figure><ul><li>In order to convert the Sass or Scss files to a CSS file, the <strong>css.map</strong> file runs in the meantime and this file does the conversion operations. There are several methods to provide these operations and convert them to CSS files. The first of these methods is to specify the Sass file you want to convert and the .css extension you want to convert manually in the terminal. For this you have to enter the following command:</li></ul><pre>sass index.scss index.css</pre><ul><li>Another method is to use extensions. As soon as we save the code with the extension, there are extensions that enable compilation and conversion to .css code. VS Code offers us a plugin called <strong>Live Sass Compiler</strong> for this. With this plugin, you can convert Sass and Scss files to .css files.</li></ul><h4>💡 Sass and Scss Spelling Rules</h4><p>📍 <strong>Sass</strong></p><p>One of the most distinctive main features of Sass is the absence of curly braces and commas. As in CSS and Scss, you will not get an error when you do not put them, on the contrary, you should not use these elements. It’s actually a great preprocessor for those who forget continuous semicolons and curly braces.</p><p>Another spelling rule is indentation. The indentation is very important in Sass because the features you want to specify are determined according to which element they belong to.</p><p>In the example below, the properties of the box are specified in a tab. If the title is in line with the box’s properties, this title is now the child element of the box, that is, it is specified as .box.header in CSS. Likewise, if the content class is under the header, this time the content is the box and the element under the header. If the content was at the level of the box, it would have been a separate class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZGN0_z6af8W9eUSrhO9yg.png" /></figure><p>📍<strong>Scss</strong></p><p>Curly braces and semicolons are used in Scss, so it is very similar to CSS, but of course, it has many different features from CSS, which I will talk about in the next topics. Unlike Sass, indentations have no meaning. Indent as much as you want, the elements do not affect each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_aOXgtrdFZG1tS0C3sIf6w.png" /></figure><h4>💡 Variables in Sass and Scss</h4><p>Variables in Sass and Scss can be used by defining them and calling them wherever desired. This allows you to easily call <strong>($name)</strong> by the name we choose, without the need to specify the same color or the same size all the time.</p><p>Values that are not defined in any element at the top are <strong>global variables</strong>. If they are not changed, they can be used everywhere with the same value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YLupe4hKtY7RxpAUdiGR2A.png" /></figure><p>There are <strong>local variables</strong> as well as global variables. Local variables are defined in the specified scope and are valid in that scope. Even if there is a local variable with the same name, they do not change the global variables, they can only change it in a single case, which changes the value defined above after making the local variable a global variable by typing<strong> !global</strong> next to the variable value defined in the scope. In addition, in the scope where a local variable with the same name is used, the local variable is checked first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ciUXSozWBxVmk-cSEiiHw.png" /></figure><p>We have come to the end of the first part of the Sass and Scss article, I will talk about other topics in the next parts.<br>See you in the next parts 👋</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FvxNCVEe0PI9A3YVJEX%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fathomewithamysedaris-amy-sedaris-at-home-with-ah208-vxNCVEe0PI9A3YVJEX&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2FvxNCVEe0PI9A3YVJEX%2Fgiphy.gif%3Fcid%3D790b76119aa043ea100c6406108beb5ce8f8ac7fc19ef015%26rid%3Dgiphy.gif%26ct%3Dg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/33c011f040ff340b9ec2fce257862eae/href">https://medium.com/media/33c011f040ff340b9ec2fce257862eae/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83e69e84247f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/sass-and-scss-part-1-83e69e84247f">SASS &amp; SCSS — Part 1</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multilanguage support with i18next in React Js]]></title>
            <link>https://medium.com/cnk-tech/multilanguage-support-with-i18next-in-react-js-62c2e2ed1cdb?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/62c2e2ed1cdb</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[i18next]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Sat, 17 Apr 2021 17:04:29 GMT</pubDate>
            <atom:updated>2021-04-17T17:04:29.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*vS_SH5XDDjtDTtbWj_eKlw.png" /></figure><p>Hello, today I will tell you how you can use the multi-language support in your React Js projects with i18next.</p><p>First of all, I want to talk about what is i18next?</p><h3>📌 i18next</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/0*6X7IbClPSDeCzQLy" /></figure><p>I18next is an <strong>internationalization framework</strong> written in and for JavaScript. But it’s much more than that.</p><p>The i18next-community created integrations for frontend frameworks such as React, AngularJS, Vue.js and many more.</p><p>You can also use i18next with Node.js, PHP, iOS, Android and other platforms.</p><p>After understanding what i18next is, I can now begin to explain how to integrate i18next into the React Js project.</p><blockquote>Start installing i18next with npm with the following command.</blockquote><pre>npm install react-i18next i18next --save</pre><pre>// if you&#39;d like to detect user language and load translation</pre><pre>npm install i18next-http-backend i18next-browser-languagedetector --save</pre><blockquote>After installing, you can import as follows.</blockquote><pre>import { useTranslation } from &#39;react-i18next&#39;;</pre><h4>📌 Configure i18next</h4><p>I18next is the core of the i18n functionality while react-i18next extends and glues it to react.</p><p>Create a new file <strong>i18n.js</strong> beside your index.js containing following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f253dcaf6820a0d7c6005ce7a3cbdd8/href">https://medium.com/media/2f253dcaf6820a0d7c6005ce7a3cbdd8/href</a></iframe><p>Here you must specify the languages you want to translate in the <strong>const Languages</strong> value. (Line: 9)</p><p>You must also specify <strong>Languages</strong> as a <strong>whitelist</strong> in <strong>init</strong>. (Line:25)</p><ul><li>After importing the i18n.js file that I created into the index.js file, I use React Suspense to wrap the &lt;App /&gt;.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/689c4278a682f969f981306e9c5b65a3/href">https://medium.com/media/689c4278a682f969f981306e9c5b65a3/href</a></iframe><h4>📌 So what is this React Suspense?</h4><p>Suspense is React’s special component that helps us to render the component we loaded dynamically and display backup content in the time until this component is loaded. Suspense component gets a single props named fallback. And this fallback props is where we specify the content to be rendered until our dynamic component is loaded or when there is a problem with the component loading.</p><ul><li>Then you will use the useTranslation hook in the functional component. And useTranslation <strong>t</strong> function and <strong>i18n</strong> instance inside your functional component.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00d40606a815f76bdf7b8dc1e3ec78d4/href">https://medium.com/media/00d40606a815f76bdf7b8dc1e3ec78d4/href</a></iframe><p>Later, I write a function named <strong>TranslateClick</strong>, since it will be based on clicking the button, I give the <strong>lang</strong> parameter as a parameter. In this way, you can choose which language to use when calling the function, and I use the <strong>i18n.changeLanguage</strong> function to change the language into this function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2c28fd8a105874240e8dd7474745740/href">https://medium.com/media/a2c28fd8a105874240e8dd7474745740/href</a></iframe><p>Yes, now it’s time to call the function in HTML tags.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e91e725b4914380581eae43560bf7f87/href">https://medium.com/media/e91e725b4914380581eae43560bf7f87/href</a></iframe><p>I have given the abbreviations I have defined in the i18m.js file as parameters to the <strong>translateClick</strong> function that I call with the <strong>onClick</strong> function. (‘tr’, ‘en’)</p><ul><li>Now it’s time for the <strong>json</strong> files to pull in translations.</li></ul><p>For this, I first create a <strong>locales</strong> folder in the <strong>public</strong> folder. Then I create the <strong>tr</strong> and <strong>en</strong> folders with the translations into this folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*H3YID9jvzxbgdw4MmKln2w.png" /></figure><p>Then I create json files named <strong>translation.json</strong> in these two folders.</p><p>I create the json file by writing the Turkish and English equivalents of the parts you will translate into these json files.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c0704b411dba501bfa1450617506a1f/href">https://medium.com/media/1c0704b411dba501bfa1450617506a1f/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b30c689b6a08a00b234d1229934b29f/href">https://medium.com/media/9b30c689b6a08a00b234d1229934b29f/href</a></iframe><p>In this way, after writing the parts to be translated in the json file, the last step is to use the structure we have prepared instead of the text to be translated in HTML.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39d124a1d836e02693ae1c3274630656/href">https://medium.com/media/39d124a1d836e02693ae1c3274630656/href</a></iframe><p>In this way, I can access the data in the json file using the t function, and when I press the Turkish-English buttons, it is possible to switch to the json data I have given.</p><p>I hope this article was useful to you. See you in my next article.</p><p>Keep working!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FaNqEFrYVnsS52%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcat-brighten-yourlaptop-aNqEFrYVnsS52&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FaNqEFrYVnsS52%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9bc71cd89327190f79dcd419bf6651b/href">https://medium.com/media/f9bc71cd89327190f79dcd419bf6651b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62c2e2ed1cdb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/multilanguage-support-with-i18next-in-react-js-62c2e2ed1cdb">Multilanguage support with i18next in React Js</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Visualization with React JS and Chart JS]]></title>
            <link>https://medium.com/codex/data-visualization-with-react-js-and-chart-js-cb6ca5d77ff6?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb6ca5d77ff6</guid>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[virtualization]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Tue, 23 Mar 2021 12:58:55 GMT</pubDate>
            <atom:updated>2021-03-24T16:58:10.491Z</atom:updated>
            <content:encoded><![CDATA[<h4><a href="http://medium.com/codex">CODEX</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*2he5U4QVMlKFYuUsTIlTGw.png" /></figure><p>Hello, today I will talk about how to use great Chart Js charts with React Js, or even how to dynamically make data visualizable using API.</p><p>I want to tell you a little bit about Chart Js. Chart.js is a free open source JavaScript library that supports different types of charts for data visualization.</p><p>So what are the types of charts that this supports?</p><p>📌 Line</p><p>📌 Bar</p><p>📌 Radar</p><p>📌 Doughnut and Pie</p><p>📌 Polar area</p><p>📌 Bubble</p><p>📌 Scatter</p><p>If you’re ready, let’s start!</p><p>To get started, you need to install the React application first. You can browse for it: <a href="https://reactjs.org/docs/create-a-new-react-app.html">https://reactjs.org/docs/create-a-new-react-app.html</a></p><p>If you have installed the React application, now it is necessary to setup Chart Js for React. One line is enough for this.</p><blockquote><strong>Installation via NPM</strong></blockquote><pre>npm install --save react-chartjs-2 chart.js</pre><blockquote><strong>Installation via YARN</strong></blockquote><pre>yarn add react-chartjs-2 chart.js</pre><p>After it is loaded, you need to create a Js file and import the chart type you want to use with the react-chartjs-2 library.</p><pre>import { <strong>Bar</strong> } from &#39;react-chartjs-2&#39;</pre><p>Then we create a function called DynamicChart, create a function called Chart and start doing the operations. First, const variables are created to hold the data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae02ed7db572df6c62e9e1b24d5df44f/href">https://medium.com/media/ae02ed7db572df6c62e9e1b24d5df44f/href</a></iframe><p>Next, we create a structure like in Chart Js’ documentation and try our own data statically.</p><p>(<a href="https://www.chartjs.org/docs/latest/getting-started/usage.html">https://www.chartjs.org/docs/latest/getting-started/usage.html</a>)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13a681290eab6026d5ac4e03521beaff/href">https://medium.com/media/13a681290eab6026d5ac4e03521beaff/href</a></iframe><p>Here you can set horizontal data with labels and vertical data with data. You can also color it with the background and border.<br><strong>Chart ()</strong> function was called with the <strong>UseEffect</strong> React method. After return (), it is specified in <strong>&lt;Bar /&gt;</strong> that it receives its data from the defined <strong>chartData</strong>, and then additions can be made to the option for the appearance of the chart.</p><p>The static chart will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RYpwRNiD39CXImUJhN_4Lw.png" /></figure><p>Okay, if you have learned how to make a bar chart statically, I will now explain how to make a dynamic bar chart by pulling data from the API with small changes.</p><p>For this, first you need to install <strong>Axios.</strong></p><p>So what is Axios?<br>Axios is a javascript library that allows easy HTTP calls in client-side applications. Available as npm or bower package or via CDN.</p><p>To include Axios in the project, it is enough to write the following line</p><pre>npm install axios --save </pre><p>Then, by typing axios.get (‘API URL) into the Chart () function, you can check whether you get the errors and data with the .then and .catch methods after specifying which URL to extract the data from.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7aeb64ce3f101f3782d732746b2076bf/href">https://medium.com/media/7aeb64ce3f101f3782d732746b2076bf/href</a></iframe><p>Now it is necessary to pull this data. You need to define two strings that work with let and get salary and age. In .then, values can be obtained by parsing the salary and age variables with the for loop. And <strong>setChartData</strong> must also be enclosed in .then for the values to appear.</p><p>Finally, in order to be dynamic, it is necessary to specify the empAge and empSal arrays to the label and data places we provide statically. In this way, as the API changes, the data will also change.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5658987170084e170c58788e011cde4e/href">https://medium.com/media/5658987170084e170c58788e011cde4e/href</a></iframe><p>The bar chart view drawn from the API will look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IfvN4r6gF5Kcxa1ID9jEYw.png" /></figure><p>Yes! With this method, you can visualize colorful and useful data from each other. If you want to try on different chart types, you just need to write the name in the import section and write your values ​​in the imported type in return.</p><h3>📌 <strong>Line Chart</strong></h3><pre>import { Line } from &#39;react-chartjs-2&#39;<br>...<br>...</pre><pre>return(<br>&lt;Line<br>.<br>.<br>. /&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXwqTOXP_zjZcbKYCMh-6A.png" /></figure><h3>📌 Radar Chart</h3><pre>import { Radar } from &#39;react-chartjs-2&#39;<br>...<br>...</pre><pre>return(<br>&lt;Radar<br>.<br>.<br>. /&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UVMKJma4KGcFFjSxxtwhg.png" /></figure><h3>📌 Doughnut and Pie Chart</h3><pre>import { Doughnut } from &#39;react-chartjs-2&#39;<br>...<br>...</pre><pre>return(<br>&lt;Doughnut<br>.<br>.<br>. /&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ydjpu9C0Lw4H7LqP7FvnrQ.png" /></figure><pre>import { Pie } from &#39;react-chartjs-2&#39;<br>...<br>...</pre><pre>return(<br>&lt;Pie<br>.<br>.<br>. /&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ltDU4EF8JTwc5f7vX1WfRg.png" /></figure><h3>📌 Polar area Chart</h3><pre>import { Polar} from &#39;react-chartjs-2&#39;<br>...<br>...</pre><pre>return(<br>&lt;Polar<br>.<br>.<br>. /&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*umy3vBulFcI7kgwZpsKfRw.png" /></figure><p>Yes, that’s it! I hope this article will be useful for you in React Js for data visualization.</p><p>If you want to review, you can take a look at my github project:</p><p><a href="https://github.com/Senakbulut/BarChart">Senakbulut/BarChart</a></p><p>See you in my next article.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FGB0lKzzxIv1te%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fbye-goodbye-the-little-rascals-GB0lKzzxIv1te&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FGB0lKzzxIv1te%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="237" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a5071e7638e5c050aa43720e96cb3ba/href">https://medium.com/media/5a5071e7638e5c050aa43720e96cb3ba/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb6ca5d77ff6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/data-visualization-with-react-js-and-chart-js-cb6ca5d77ff6">Data Visualization with React JS and Chart JS</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Directives]]></title>
            <link>https://medium.com/cnk-tech/custom-directives-9962fa810f9a?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9962fa810f9a</guid>
            <category><![CDATA[directives]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[custom]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Mon, 01 Mar 2021 16:54:00 GMT</pubDate>
            <atom:updated>2021-03-01T16:56:40.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7E6H-jtiv9yJ8PGbNd9HA.jpeg" /></figure><p>Hello, today I will talk about the custom directives we use in Vue JS. So what are custom directives? Let’s start!</p><h3><strong>Understanding Custom Directives</strong></h3><p>They are special directives that we can use in addition to the normal directives.</p><p>Custom directives enrich HTML with new reactive functionality that’s fully managed by Vue JS.</p><p>Custom directives consist of 5 different hooks. These are <strong><em>bind</em></strong>, <strong><em>inserted</em></strong>, <strong><em>update</em></strong>, <strong><em>componentUpdated</em></strong>, and <strong><em>unbind</em></strong>.</p><p>Parameters and extra functions can be defined like normal directives.</p><h3><strong>Hook Functions</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUrJL34yFM5YLPaSXmvzcg.jpeg" /></figure><p>🔸 <strong>bind(el, binding, vnode): </strong>It is called once when the directive is first connected to the element. It takes three parameters, these are: <strong><em>el</em></strong>, <strong><em>binding</em></strong>, and <strong><em>vnode</em></strong>. We’ll look at these parameters extra later.</p><p>🔸 <strong>inserted(el, binding, vnode): </strong>This hook occurs when the item is added to the parent DOM. That is, it is called when the element to which the directive is attached is added to its parent. It takes the same directives as bind.</p><p>🔸 <strong>update(el, binding, vnode, oldVnode): </strong>It is called when the component containing the directive is updated. At this stage, Children Nodes have not been updated yet. In addition, it has the oldVnode parameter.</p><p>🔸<strong> componentUpdated(el, binding, vnode, oldVnode):</strong> This hook is called once the component <em>and</em> the children have been updated. It has the oldVnode parameter like update hook.</p><p>🔸 <strong>unbind(el, binding, vnode): </strong>This hook is called once the directive is removed.</p><p>Let’s take a look at these parameters.</p><h3>Directive Hook Arguments</h3><p>Let’s take a closer look at these arguments that we see in the parameters of Hooks.</p><p>🔹 <strong>el: </strong>This parameter represents the element that this custom directive is applied to. This can be used to directly manipulate the DOM.</p><p>🔹 <strong>binding: </strong>This input parameter is an object containing the following properties:</p><ul><li>name: The name of the directive, without the v- prefix. For example, using a custom directive as v-focus yields a name of focus.</li><li>value: The value passed to the directive. For example, using the v-exp=”prop” directive yields a value of prop.</li><li>oldValue: The previous value, only available in update and componentUpdated. It contains the previous value of the directive, before the update.</li><li>expression: The expression of the binding as a string. For example in v-adding =&quot;2 + 2&quot;, the expression would be &quot;2 + 2&quot;.</li><li>arg: The argument passed to the directive, if any. For example in v-example:default, the arg would be &quot;default&quot;.</li><li>modifiers: An object containing modifiers, if any. That is, if the modifier is set to true, if not, it is not seen by the directive. For example,{ foo: true, bar: true }.</li></ul><p>🔹 <strong>vnode: </strong>It is the virtual node produced by Vue’s compiler.</p><p>🔹<strong>oldVnode: </strong>The previous virtual node, only available in the <em>update</em> and <em>componentUpdated</em> hooks.</p><h3>Building a Custom Directive</h3><p>Now let’s build a custom directive in your mind so that you can better understand the custom directives.</p><blockquote>Vue JS</blockquote><pre>Vue.directive(&#39;exp&#39;, {<br>  bind(el, binding, vnode) {   <br>  <strong>el.style.position = &#39;fixed&#39; </strong>  <br>} });</pre><p>First, we specify that we want to create a directive called exp, then we start to make edits on the paragraph we selected in HTML with the bind hook.</p><blockquote>HTML</blockquote><pre>&lt;p <strong>v-exp</strong>&gt;It will remain fixed on the page&lt;/p&gt;</pre><p>📍If we want to put the item a certain pixel away, we need to update it as follows.</p><blockquote>Vue JS</blockquote><pre>Vue.directive(&#39;exp&#39;, {<br>  bind(el, binding, vnode) {   <br>  el.style.position = &#39;fixed&#39;<br>  <strong>el.style.top = binding.value + &#39;px&#39;</strong><br>} });</pre><p>We need to specify 50px top space in HTML.</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;app&quot;&gt; <br>  &lt;p&gt;Scroll down the page&lt;/p&gt;  <br>  &lt;p <strong>v-exp=&quot;50&quot;</strong>&gt;Stick me 50px from the top of the page&lt;/p&gt; <br>&lt;/div&gt;</pre><p>📍To leave a space from the right or top, we can make an update using binding.arg</p><blockquote>Vue JS</blockquote><pre>Vue.directive(&#39;exp&#39;, {  <br> bind(el, binding, vnode) {     <br> el.style.position = &#39;fixed&#39;;  <br> <strong>const s = (binding.arg == &#39;right&#39; ? &#39;right&#39; : &#39;top&#39;);  <br> el.style[s] = binding.value + &#39;px&#39;;</strong>   } });</pre><p>Here, if there is right expression in HTML, 50px to the right, if not 50px to the top.</p><blockquote>HTML</blockquote><pre>&lt;p <strong>v-exp:right=&quot;50&quot;</strong>&gt;I&#39;ll now be offset from the left instead of the top&lt;/p&gt;</pre><p>📍If you want to use more than one value, you can follow the following way.</p><blockquote>HTML</blockquote><pre>&lt;p <strong>v-exp=&quot;{ top: &#39;30&#39;, left: &#39;110&#39; }&quot;</strong>&gt;Stick me 30px from the top of the page and 110px from the left of the page&lt;/p&gt;</pre><blockquote>Vue JS</blockquote><pre>Vue.directive(&#39;exp&#39;, {  <br> bind(el, binding, vnode) {    <br> el.style.position = &#39;fixed&#39;;   <br> <strong>el.style.top = binding.value.top + &#39;px&#39;;   <br> el.style.left = binding.value.left + &#39;px&#39;;</strong>   } });</pre><p>Yes, we did it!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FMOWPkhRAUbR7i%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fexcited-applause-minions-MOWPkhRAUbR7i&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2FMOWPkhRAUbR7i%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="196" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd4c366e1bebe309f8b852c7fb108c33/href">https://medium.com/media/bd4c366e1bebe309f8b852c7fb108c33/href</a></iframe><p>I tried to explain everything about custom directives as much as I could. I hope it was a useful article. Bye now.</p><p>See you in my next article 👋🏻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9962fa810f9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/custom-directives-9962fa810f9a">Custom Directives</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS GRID LAYOUT]]></title>
            <link>https://medium.com/star-gazers/css-grid-layout-ef82a7c6b85c?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef82a7c6b85c</guid>
            <category><![CDATA[grid]]></category>
            <category><![CDATA[layout]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 16:24:42 GMT</pubDate>
            <atom:updated>2021-02-26T17:07:01.416Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qe5keHwkCPQD8v2U.png" /></figure><p>Hello, today I want to tell you about the CSS Grid Layout. So, what is this CSS Grid Layout? What does it do? So let’s start!</p><p>CSS Grid is a great module that simplifies web design by providing Grid structure with rows and columns. Thanks to the CSS Grid, you can easily apply your designs to websites without the need for various positioning. So no need to tire yourself like this guy to the position with CSS :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FyYSSBtDgbbRzq%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffrustrated-annoyed-programming-yYSSBtDgbbRzq&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FyYSSBtDgbbRzq%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/c91c6267b2cc86329edb978579fd1e9c/href">https://medium.com/media/c91c6267b2cc86329edb978579fd1e9c/href</a></iframe><p>Now I want to tell you about the components of CSS Grid.</p><h3><strong>Grid Container</strong></h3><p>Child elements of the element defined by the <strong><em>grid container</em></strong> become grid elements.</p><p><strong>display:grid:</strong> generates a block-level grid</p><p><strong>display:inline-grid: </strong>generates an inline-level grid</p><pre>.container{<br>    display:grid; }<strong><br>OR</strong><br>.container{<br>    display:inline-grid; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH_Jpw3jWA0HJB9TNbB0Ow.png" /></figure><h3><strong>Grid Gap</strong></h3><p>They are spaces between rows and /or columns, not for outer edges.</p><p><strong>grid-gap:</strong> With <strong><em>grid-gap</em></strong>, you can value the gaps of all rows and columns (px, em,%, etc.)</p><pre>.container{<br>    grid-gap: 1em; }<br><strong>OR</strong><br>.container{<br>    grid-gap: 1em 1em; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*pT-PCWhX05dxvn0N9oaKeg.png" /></figure><p>Or you can specify these values separately using <strong>grid-column-gap</strong> and <strong>grid-row-gap</strong>.</p><pre>.container{<br>    grid-row-gap:    1em;<br>    grid-column-gap: 1em; }</pre><h3><strong>Grid Tracks</strong></h3><p>The grid is used to define rows and columns. We can also think of Grid tracks as the parts between two lines. We can use these rows and columns as follows:</p><pre>.container{<br>   grid-template-rows: 50px 100px 50px;<br>   grid-template-columns: 50px 100px; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*afCxxhWC-eppgYFYb-potg.png" /></figure><p>In this way, you can create divs with different numbers and different pixel sizes.</p><p>📌 Likewise, if you want to make divs with the same pixels, you can use <strong>repeat (number, size)</strong>.</p><pre>.container{<br> grid-template-rows:  repeat(3,100px); <br> grid-template-columns: repeat(2,1fr); <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*z9DgM6cW_94uMbJAlZgmDQ.png" /></figure><p>📌 I want to tell you about it when I used <strong><em>“fr”</em></strong> here.</p><p>With <strong><em>fr</em></strong>, we can create flexible grid tracks. We can obtain structures that cover the size of the screen and that can flexibly shrink and grow.</p><h3><strong>Positioning Items by Grid Line Number</strong>s</h3><p>Grid lines are essentially lines that represent the start of, the end of, or between the column and row tracks. Each line, starting from the start of the track and in the direction of the grid, is numbered incrementally starting from 1.</p><p>For example, we want to replace the 1st div with the 4th div. If we say what we can do for this, <strong>grid-row-start / end</strong>, <strong>grid-column-start / end</strong> will help us.</p><p>Let’s set the position by entering the row, column start and end values.</p><pre>.itemone{<br>grid-row-start: 2;<br>grid-row-end: 3;<br>grid-column-start: 2;<br>grid-column-end:   3;  }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*NWNxkODTvtRB9UYEwxt6eg.png" /></figure><p>📌 So what should we do if we don’t want to write that long? Of course, there is a shortcut for this, <strong>grid-row </strong>and<strong> grid-column.</strong></p><pre>.itemone{<br>grid-row: 2;<br>grid-column: 2 / 3; } //starting and ending line numbers</pre><p>📌 What if this still seems long to you? I can hear you asking if this has a shortcut too. Yes, these also have a shortcut:<strong> grid-area.</strong></p><p>The syntax for the grid-area is, <strong><em>grid-area: grid-row-start / grid-column-start / grid-row-end / grid-column-end</em></strong></p><pre>.itemone{<br>grid-area: 2 / 2 / 3 / 3; }</pre><p>We can also use these expressions very easily to spread the divs.</p><pre>.itemone{<br>    grid-row: 2 / 4;<br>    grid-column: 1 / 3; <br>}<br><strong>OR<br></strong>.itemone{<br>    grid-row: span 2;<br>    grid-column: span 2; <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXlKsEhbjBqSHOwwDQC9QQ.png" /></figure><p>In this way, we get the look we want.<br>Hmm, did you notice anything different? Yes, we’ve never seen the <strong><em>span</em></strong> expression before. So what is this <strong><em>span</em></strong> and what is it for?</p><p>📌 Coverage will be made as much as the number of grids written with <strong>span</strong>.</p><h3>Naming and Positioning Items by Grid Areas</h3><p>For naming and positioning by grid areas, we need to pay attention to two properties. These are, <strong>grid-area</strong> and <strong>grid-template-areas.</strong></p><p><strong>grid-area</strong>, gives an item a name so that it can be referenced by a template created with the grid-template-areas property.</p><pre>.itemone{<br>   grid-area:header;<br>}<br>.itemtwo{<br>   grid-area:main; <br>} </pre><p><strong>grid-template-areas</strong>, specifies named grid areas, establishing the cells in the grid and assigning them names.</p><pre>.container{<br>  grid-template-areas: <br>  &quot;header header header header&quot;    <br>  &quot;main main . sidebar&quot;            // <strong>&quot;.&quot; is empty area</strong><br>  &quot;footer footer footer footer&quot;; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUyv9o0NkEyp3oREvOBjyw.png" /></figure><h4>📌 <strong>auto-fill and auto-fit</strong></h4><p><strong>auto-fill:</strong> It fills the row with as many columns as it can fit, so there are gaps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PhNgY7YmceD_2tZinSGaaQ.png" /></figure><p>📌<strong>auto-fit: </strong>Arranges columns as they take up all available space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-I-v62ycJ4aog6SURQS8A.png" /></figure><h3>Implicit Grid</h3><p>Implicit grid get created when there are more grid items than cells in the grid or when a grid item is placed outside of the explicit grid.</p><p>The implicit grid can be defined using the <strong>grid-auto-rows</strong>, <strong>grid-auto-columns</strong>, and <strong>grid-auto-flow</strong> properties.</p><pre>.container{<br> grid-template-rows: 50px;<br> grid-template-columns:    repeat(2, 1fr);<br> grid-auto-rows: 100px;  <br>} </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TmYbKzpyhdP6XoExw7omeg.png" /></figure><p>A second row track was auto-created to make room for items 3 and 4.</p><p><strong>grid-auto-flow:</strong> Controls how auto-placed items are placed on the grid.</p><pre>.container{<br>grid-auto-flow: row; <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QZCQ0DS8AeQGQ3wIUUFaHA.png" /></figure><pre>.container{<br>grid-auto-flow: column; <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yIYrbUnwPK79em1150CmMQ.png" /></figure><h3>Aligning Grid Items</h3><p><strong>justify-items</strong> and <strong>align-items</strong> properties are used to align divs inside the container.</p><p><strong>justify-items:</strong> Allows grid items to align on the vertical axis.</p><pre>.container { <br>justify-items: start | end | center | stretch; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*CvTtt3Oil6sCimY9ImP7ig.png" /><figcaption>justify-items: center;</figcaption></figure><p><strong>align-items: </strong>Allows grid items to align on the horizontal axis.</p><pre>.container { <br>align-items: start | end | center | stretch; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IsftcBPCLlzToV8A8gp9Ug.png" /><figcaption>align-items: end;</figcaption></figure><h3>Aligning Grid Tracks</h3><p>If we want to align the grid tracks, this time we need to use<strong> justify-content</strong> and <strong>align-content</strong>.</p><p><strong>justify-content:</strong> Grid aligns the tracks on the horizontal axis.</p><pre>.container {   <br>justify-content: start | end | center | stretch | space-around | space-between | space-evenly;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5XwkCA5EqT4YGYvCnMUKQ.png" /><figcaption>justify-content:center;</figcaption></figure><p><strong>align-content: </strong>Grid aligns the tracks on the vertical axis.</p><pre>.container {   <br>align-content: start | end | center | stretch | space-around | space-between | space-evenly; }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCl7WsW844bjw33oYD4txA.png" /><figcaption>align-content:center;</figcaption></figure><p>Yeah, that’s it!</p><p>I hope this article was useful to you. See you in my next article 👋</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F7DzlajZNY5D0I%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fgirls-weird-sassy-7DzlajZNY5D0I&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2F7DzlajZNY5D0I%2Fgiphy.gif%3Fcid%3D790b7611607920786358a40dd22d6e0f47cfe51d7b5c09e8%26rid%3Dgiphy.gif%26ct%3Dg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd273045daf291ef414cb1993f38efe2/href">https://medium.com/media/fd273045daf291ef414cb1993f38efe2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef82a7c6b85c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/star-gazers/css-grid-layout-ef82a7c6b85c">CSS GRID LAYOUT</a> was originally published in <a href="https://medium.com/star-gazers">Star Gazers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vue JS Directives]]></title>
            <link>https://medium.com/cnk-tech/vue-js-directives-6e4ead723c9e?source=rss-e4e506c7b3d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e4ead723c9e</guid>
            <category><![CDATA[directives]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sena Akbulut]]></dc:creator>
            <pubDate>Tue, 09 Feb 2021 14:09:57 GMT</pubDate>
            <atom:updated>2021-02-09T14:09:57.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*z2p8Z8ZnPPkEjrwxcrix_g.png" /></figure><p>Hello, today I will talk about directives that have an important place for Vue Js.</p><h3><strong>Directives</strong></h3><p>These are features that can be added directly to HTML codes. Thanks to the directives, dynamic properties are given to HTML codes.</p><p>Directive formats are v- …...</p><p>If we take a general look at the directives:</p><ul><li>v-text</li><li>v-html</li><li>v-show</li><li>v-if</li><li>v-else-if</li><li>v-else</li><li>v-for</li><li>v-on</li><li>v-bind</li><li>v-model</li></ul><p>Let’s take a closer look at these directives.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F0DYipdNqJ5n4GYATKL%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FBTTF-back-to-the-future-bttf-one-0DYipdNqJ5n4GYATKL&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2F0DYipdNqJ5n4GYATKL%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/87739dac3dfdb888c98b31c6b9a5390f/href">https://medium.com/media/87739dac3dfdb888c98b31c6b9a5390f/href</a></iframe><h3><strong>v-text</strong></h3><p>The <strong>v-text</strong> directive is a Vue.js directive used to update an element’s <strong>textContent</strong> with our data.</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;span v-text=&quot;msg&quot; id=&quot;app&quot;&gt;&lt;/span&gt;<br>&lt;!-- same as --&gt;<br>&lt;span&gt;{{msg}}&lt;/span&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({<br>el: &#39;#app&#39;,<br>data: {<br>message: &#39;Hello this is text.&#39;<br>}<br>})</pre><h3><strong>v-html</strong></h3><p>The <strong>v-html</strong> directive is a Vue.js directive used to update an element’s innerHTML with our data. This is what separates it from<strong> v-text</strong> which means while v-text accepts string and treats it as a string it will accept string and render it into HTML.</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;home&quot;&gt;<br>      &lt;p v-html=&quot;dataHtml&quot;&gt;&lt;/p&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({<br>el: &quot;#home&quot;,<br>data:{<br>      dataHtml: &quot;&lt;b&gt;Hello&lt;/b&gt;&quot;<br>}<br>})</pre><h3><strong>v-show</strong></h3><p>The <strong>v-show</strong> directive is a Vue.js directive used to toggle the display CSS property of an element with our data. If the data is true it will make it visible else it will make it invisible.</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;home&quot;&gt;<br>      &lt;p v-show=&quot;data1&quot;&gt;{{ data1 }}&lt;/p&gt;<br>      &lt;p v-show=&quot;data2&quot;&gt;{{ data2}}&lt;/p&gt;      <br>      &lt;p v-show=&quot;data3&quot;&gt;dont work&lt;/p&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({<br>el: “#home”,<br>data:{<br> data1: “Hello”,<br> data2: true,<br> data3: false<br>}<br>})</pre><h3><strong>v-if</strong></h3><p>The directive <strong>v-if </strong>is used to conditionally render a block. The block will only be rendered if the directive’s expression returns a truthy value.</p><p>Considering v-if, v-else-if and v-else directives in one example</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;app&quot;&gt;<br>&lt;h2 v-if=&quot;data &gt; 50&quot;&gt;<br>data is greater than 50<br>&lt;/h2&gt;<br></pre><h3><strong>v-else-if</strong></h3><p><strong>v-else-if</strong> directive is a Vue.js directive used to toggle the display CSS property of an element depending on a condition when if the condition is not satisfied.</p><blockquote>HTML</blockquote><pre>&lt;h2 v-else-if=&quot;data &lt; 50&quot;&gt;<br>data is smaller than 50<br>&lt;/h2&gt;</pre><h3><strong>v-else</strong></h3><p><strong>v-else</strong> directive is used to display content only when the expression in adjacent v-if resolves to false.</p><blockquote>HTML</blockquote><pre>&lt;h2 v-else&gt;<br>data is equal to 50<br>&lt;/h2&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({<br>el: &#39;#app&#39;,<br>data: {<br>data: 40<br>}<br>})</pre><h3><strong>v-for</strong></h3><p><strong>v-for</strong> directive is a Vue.js directive used to loop over a data usually an array or object.</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;app&quot;&gt;<br>&lt;h2 v-for=&quot;data in datas&quot;&gt;<br>{{ data }}<br>&lt;/h2&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({<br>el: &#39;#app&#39;,<br>data: {<br>datas: [<br>&#39;String1&#39;,<br>&#39;String2&#39;,<br>&#39;String3&#39;<br>]<br>}})</pre><p>The three strings in the array sequentially rotated and printed on the screen.</p><h3><strong>v-on</strong></h3><p>We can use the <strong>v-on</strong> directive to listen to DOM events and run some JavaScript when they’re triggered.</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;app&quot;&gt; <br>&lt;button v-on:click=&quot;counter += 1&quot;&gt;Add 1&lt;/button&gt;  <br>&lt;p&gt;The button above has been clicked {{ counter }} times.&lt;/p&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app= new Vue({   <br>el: &#39;#app&#39;,   <br>data: {     <br>counter: 0   <br>}})</pre><p>With this code, as you press the button, the number on the screen increases by 1.</p><h3><strong>v-bind</strong></h3><p>With <strong>v-bind </strong>we can manipulate any attribute in an element and add optional attribute if we want.</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;home&quot;&gt;<br>&lt;p v-bind:class=&quot;className&quot; v-bind:id=&quot;idValue&quot;&gt;Name&lt;/p&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({<br>el: &quot;#home&quot;,<br>data:{<br>      className: &quot;Hello&quot;,<br>      idValue: &quot;12&quot;<br>}<br>})</pre><h3><strong>v-model</strong></h3><p>We can use the <strong>v-model</strong> directive to create two-way data bindings on form input, textarea, and select elements</p><p>Example:</p><blockquote>HTML</blockquote><pre>&lt;div id=&quot;home&quot;&gt;<br>      &lt;input type=&quot;text&quot; v-model=&quot;inputt&quot; /&gt;<br>      &lt;p&gt;{{ inputt }}&lt;/p&gt;<br>&lt;/div&gt;</pre><blockquote>Vue JS</blockquote><pre>var app = new Vue({</pre><pre>el: &quot;#home&quot;,<br>data:{<br>      inputt: &quot;Hello&quot;<br>}<br>})</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F1jkVi22T6iUrQJUNqk%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffallontonight-nope-bye-1jkVi22T6iUrQJUNqk&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2F1jkVi22T6iUrQJUNqk%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="428" frameborder="0" scrolling="no"><a href="https://medium.com/media/563cdb083f57d72d3b4b96db039d1077/href">https://medium.com/media/563cdb083f57d72d3b4b96db039d1077/href</a></iframe><p>Yess! We have finished the most used Vue Js directives!</p><p>I hope this article has helped you.</p><p>See you in the next post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e4ead723c9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cnk-tech/vue-js-directives-6e4ead723c9e">Vue JS Directives</a> was originally published in <a href="https://medium.com/cnk-tech">CNK Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>