<?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 Utku Kaba on Medium]]></title>
        <description><![CDATA[Stories by Utku Kaba on Medium]]></description>
        <link>https://medium.com/@utkukaba?source=rss-416442f079a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*m2HMAOXvKuyueJ-gnqZVXg.jpeg</url>
            <title>Stories by Utku Kaba on Medium</title>
            <link>https://medium.com/@utkukaba?source=rss-416442f079a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:09:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@utkukaba/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[A Modern Approach to Global State Management with Zustand]]></title>
            <link>https://medium.com/huawei-developers/a-modern-approach-to-global-state-management-with-zustand-8a772e877f21?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a772e877f21</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[zustand]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Wed, 14 May 2025 11:20:55 GMT</pubDate>
            <atom:updated>2025-05-14T11:21:16.074Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xvuLNo9RpvqgN7pSO8sFg.png" /><figcaption>Zustand</figcaption></figure><h3>Introduction</h3><p>Global state management in React projects becomes inevitable as applications grow in complexity. At this point, we encounter various solutions such as Redux, Context API, and MobX. However, in the 2020s, developer-friendly, minimal, and performance-oriented solutions have come to the forefront. Zustand is one of the most popular among these modern tools.</p><p>In this article, we’ll explore what Zustand aims to achieve, why it can be a good choice, how it differs from other state management tools, and how to use it in practice.</p><h4>What is Zustand Aiming For?</h4><p>Zustand aims to provide boilerplate-free, performant, and easy-to-understand global state management for React applications.</p><p>React’s built-in hooks like useState and useReducer are powerful at the component level. However, they can fall short when it comes to sharing state across the application. Zustand addresses this problem with the following goals:</p><ul><li>Reducing complexity with a minimal API</li><li>Providing a global store without requiring a provider structure</li><li>Delivering performant renders via selector support</li><li>Offering flexibility, including usage outside of React</li><li>Being as powerful as Redux but far more minimal</li></ul><h4>Why Zustand?</h4><p>Redux and Context API are two of the most commonly used tools for state management in React. Zustand bridges the gap between them — combining Redux’s power with the simplicity of Context API.</p><p><strong>Highlights of Zustand:</strong></p><ul><li><strong>Simple API:</strong> As straightforward as useState. Store definition and usage can be done in single lines.</li><li><strong>Boilerplate-Free Development:</strong> No need to deal with actions, reducers, or dispatch like in Redux.</li><li><strong>Performance:</strong> Components re-render only when the specific state they use changes.</li><li><strong>Rich Ecosystem:</strong> Offers plugins for advanced needs like persist, devtools, and middleware.</li><li><strong>Minimal Size:</strong> Extremely lightweight, ~1KB when gzipped.</li></ul><p>Its scalability — from small apps to enterprise-level projects — has made Zustand increasingly popular.</p><h4>Zustand and React Workflows</h4><p>Zustand integrates directly with React’s hook-based structure. It can be added to a project without requiring drastic changes in code organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*B3n9l6BoeL0Y013ov_cv5A.png" /><figcaption>Zustand Workflow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*W6tzPX0oYCt14E-XtH9kyA.png" /><figcaption>Redux Workflow</figcaption></figure><p>A typical Zustand workflow looks like this:</p><ol><li><strong>Store Definition:</strong> A central state store is created.</li><li><strong>Component Usage:</strong> The state is accessed via custom hooks like useStore().</li><li><strong>State Updates:</strong> The store provides functions to update its data.</li><li><strong>Selector Usage:</strong> Only the required parts of the state are subscribed to, improving performance.</li></ol><p>Zustand works in parallel with core React hooks like useState or useReducer. Unlike Redux or Context, it doesn’t need a provider — which makes it especially useful in deeply nested component trees.</p><h4>Using Zustand: Installation and First Store</h4><p>To get started, install Zustand using:</p><pre>npm install zustand</pre><p>Then, define a store:</p><pre>// store/counterStore.js<br>import { create } from &#39;zustand&#39;;<br><br>const useCounterStore = create((set) =&gt; ({<br>  count: 0,<br>  increment: () =&gt; set((state) =&gt; ({ count: state.count + 1 })),<br>  decrement: () =&gt; set((state) =&gt; ({ count: state.count - 1 })),<br>}));<br><br>export default useCounterStore;</pre><p>Now you can connect this store to any component:</p><pre>// components/Counter.jsx<br>import React from &#39;react&#39;;<br>import useCounterStore from &#39;../store/counterStore&#39;;<br><br>export default function Counter() {<br>  const { count, increment, decrement } = useCounterStore();<br><br>  return (<br>    &lt;div style={{ textAlign: &#39;center&#39; }}&gt;<br>      &lt;h2&gt;Counter: {count}&lt;/h2&gt;<br>      &lt;button onClick={increment}&gt;Increment&lt;/button&gt;<br>      &lt;button onClick={decrement}&gt;Decrement&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>No need for a context provider, reducer structure, or action definitions. Just call the hook and use the state.</p><h4>Advanced Features</h4><p>Zustand is not only a simple state manager — it also supports advanced use cases.</p><p><em>1. Performance Optimization with Selectors</em></p><p>Zustand allows you to select only part of the state, preventing unnecessary re-renders:</p><pre>const count = useCounterStore((state) =&gt; state.count);</pre><p>In this case, the component won’t re-render when functions like increment or decrement change.</p><p><em>2. Middleware Support</em></p><p>Zustand supports middleware, enabling features like persist, devtools, and immer:</p><pre>import { create } from &#39;zustand&#39;;<br>import { persist } from &#39;zustand/middleware&#39;;<br><br>const useStore = create(<br>  persist(<br>    (set) =&gt; ({<br>      theme: &#39;light&#39;,<br>      toggleTheme: () =&gt;<br>        set((state) =&gt; ({ theme: state.theme === &#39;light&#39; ? &#39;dark&#39; : &#39;light&#39; })),<br>    }),<br>    { name: &#39;theme-storage&#39; }<br>  )<br>);</pre><p>In this example, the theme state is saved to localStorage and preserved across page reloads.</p><p><em>3. Async Actions</em></p><p>Zustand allows asynchronous operations using async/await directly inside the set function:</p><pre>const useUserStore = create((set) =&gt; ({<br>  user: null,<br>  fetchUser: async () =&gt; {<br>    const res = await fetch(&#39;/api/user&#39;);<br>    const data = await res.json();<br>    set({ user: data });<br>  },<br>}));</pre><p><em>4. Modular Store Structure</em></p><p>You can split your store into multiple modules for better organization — especially useful in large applications.</p><pre>// store/authStore.js<br>// store/cartStore.js<br>// store/themeStore.js</pre><h4>Conclusion</h4><p>Zustand is a lightweight yet powerful library that simplifies state management in React. It delivers effective global state management with minimal boilerplate, without diving into the complexity of Context or Redux.</p><p>Whether you’re building a small app or a large-scale project, Zustand is a modern and efficient choice worth exploring.</p><h4>References</h4><p><a href="https://zustand.docs.pmnd.rs/getting-started/introduction">Introduction - Zustand</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a772e877f21" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/a-modern-approach-to-global-state-management-with-zustand-8a772e877f21">A Modern Approach to Global State Management with Zustand</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zustand ile Global State Yönetimine Modern Bir Yaklaşım]]></title>
            <link>https://medium.com/huawei-developers-tr/zustand-ile-global-state-y%C3%B6netimine-modern-bir-yakla%C5%9F%C4%B1m-8d046b354eb9?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d046b354eb9</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[zustand]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Wed, 14 May 2025 11:20:37 GMT</pubDate>
            <atom:updated>2025-05-14T11:20:37.783Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xvuLNo9RpvqgN7pSO8sFg.png" /><figcaption>Zustand</figcaption></figure><h3>Giriş</h3><p>React projelerinde global state yönetimi, özellikle büyüyen uygulamalarda kaçınılmaz hale gelir. Bu noktada karşımıza Redux, Context API, MobX gibi pek çok çözüm çıkar. Ancak 2020’li yıllarda geliştirici dostu, minimal ve performans odaklı çözümler ön plana çıkmaya başladı. <strong>Zustand</strong> da bu yeni nesil çözümlerin en çok tercih edilenlerinden biri.</p><p>Bu yazıda Zustand’ın neyi hedeflediğini, neden tercih edilebileceğini, diğer state yönetim araçlarıyla farklarını ve nasıl kullanılacağını öğreneceğiz.</p><h4>Zustand Neyi Hedefliyor?</h4><p>Zustand, React uygulamalarında <strong>boilerplate’siz</strong>, <strong>performanslı</strong> ve <strong>kolay anlaşılır</strong> bir global state yönetimi sunmayı hedefler.</p><p>React’in useState ve useReducer gibi hook&#39;ları bileşen düzeyinde güçlüdür; ancak uygulama genelinde state paylaşımı gerektiğinde bu araçlar yetersiz kalabilir. Zustand, bu problemi çözmek için şu hedefleri gözetir:</p><ul><li>Minimal API ile karmaşıklığı azaltmak</li><li>Provider yapısına gerek duymadan global store sunmak</li><li>Selector destekli performanslı render yapısı</li><li>React dışı kullanım da dahil olmak üzere esnek yapı</li><li>Redux gibi güçlü ama çok daha sade</li></ul><h4>Neden Zustand?</h4><p>React ile birlikte en çok kullanılan global state yönetimi araçlarından bazıları Redux ve Context API’dir. Zustand ise bu ikisinin arasında bir köprü kurar: <strong>Redux’un gücünü, Context API’nin sadeliğiyle birleştirir.</strong></p><h4>Zustand’ı Öne Çıkaran Noktalar</h4><ul><li><strong>Basit API:</strong> useState kadar sade bir kullanım sağlar. Store tanımı ve kullanımı tek satırlarda halledilebilir.</li><li><strong>Boilerplate’siz Geliştirme:</strong> Redux’ta olduğu gibi actions, reducers, dispatch gibi yapılarla uğraşmana gerek yoktur.</li><li><strong>Performans:</strong> Bileşenler yalnızca ihtiyaç duyduğu state değiştiğinde yeniden render edilir.</li><li><strong>Zengin Ekosistem:</strong> Persist, devtools, middleware gibi gelişmiş ihtiyaçlar için ayrı ayrı modüller sunar.</li><li><strong>Minimal Boyut:</strong> Gzip ile ~1KB’lık boyutuyla oldukça hafiftir.</li></ul><p>Küçük projelerden enterprise uygulamalara kadar her ölçekte kullanılabilir olması, Zustand’ı son dönemde daha da popüler hale getirmiştir.</p><h4>Zustand ve React Workflow’ları</h4><p>Zustand, React’in hook tabanlı yapısına doğrudan entegre olur. Bu sayede kod yapısında herhangi bir radikal değişiklik gerekmeden projeye entegre edilebilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*B3n9l6BoeL0Y013ov_cv5A.png" /><figcaption>Zustand Workflow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*W6tzPX0oYCt14E-XtH9kyA.png" /><figcaption>Redux Workflow</figcaption></figure><p>Zustand ile çalışırken tipik bir iş akışı şu şekildedir:</p><ol><li><strong>Store Tanımı:</strong> Uygulama düzeyinde bir durum deposu oluşturulur.</li><li><strong>Bileşende Kullanım:</strong> useStore() gibi custom hook’lar aracılığıyla store’daki verilere erişilir.</li><li><strong>State Güncelleme:</strong> Store içerisindeki fonksiyonlar sayesinde güncelleme işlemleri yapılır.</li><li><strong>Seçici Kullanım (Selector):</strong> Yalnızca ihtiyaç duyulan veriler bileşenlere alınarak performans artırılır.</li></ol><p>Zustand, tıpkı useState veya useReducer gibi React’in temel yapı taşlarına paralel çalışır. Ayrıca Redux ya da Context gibi ekstra provider yapılarına gerek kalmadan her yerden erişim sağlar. Bu da onu özellikle component tree’nin derin olduğu yapılarda kullanışlı hale getirir.</p><h4>Zustand Kullanımı: Kurulum ve İlk Store</h4><p>Başlamak için Zustand kütüphanesini aşağıdaki komutla kurabiliriz:</p><pre>npm install zustand</pre><p>Ardından bir store oluşturalım:</p><p>Oluşturduğumuz store bir hooktur. İçine her şeyi koyabiliriz: primitive değerler, nesneler, fonksiyonlar. set fonksiyonu ise state’i birleştirerek günceller.</p><pre>// store/counterStore.js<br>import { create } from &#39;zustand&#39;;<br><br>const useCounterStore = create((set) =&gt; ({<br>  count: 0,<br>  increment: () =&gt; set((state) =&gt; ({ count: state.count + 1 })),<br>  decrement: () =&gt; set((state) =&gt; ({ count: state.count - 1 })),<br>}));<br><br>export default useCounterStore;</pre><p>Artık component’larınıza store’u bağlayabilirsiniz.<br>Zustand ile herhangi bir provider tanımlamanıza gerek kalmadan hook’u istediğiniz yerde kullanabilirsiniz.</p><pre>// components/Counter.jsx<br>import React from &#39;react&#39;;<br>import useCounterStore from &#39;../store/counterStore&#39;;<br><br>export default function Counter() {<br>  const { count, increment, decrement } = useCounterStore();<br><br>  return (<br>    &lt;div style={{ textAlign: &#39;center&#39; }}&gt;<br>      &lt;h2&gt;Sayaç: {count}&lt;/h2&gt;<br>      &lt;button onClick={increment}&gt;Artır&lt;/button&gt;<br>      &lt;button onClick={decrement}&gt;Azalt&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>Artık useCounterStore() hook’unu bileşen içinde çağırarak hem state’e erişebiliyor hem de güncelleyebiliyoruz. Ekstra bir context provider’a, reducer yapısına ya da action tanımlamaya gerek yok.</p><h4>Gelişmiş Özellikler</h4><p>Zustand yalnızca basit bir state yönetim aracı değil, aynı zamanda ileri düzey kullanım senaryolarını da destekleyen güçlü bir araçtır. İşte bazı gelişmiş özellikleri:</p><p>1. <em>Selector Kullanımı ile Performans Optimizasyonu</em></p><p>Zustand, hook ile state’in yalnızca bir kısmını seçmenize olanak tanır. Bu, gereksiz render’ların önüne geçer. Örneğin sadece count değerine abone olmak istiyorsanız:</p><pre>const count = useCounterStore((state) =&gt; state.count);</pre><p>Bu sayede increment veya decrement fonksiyonları değiştiğinde component yeniden render edilmez.</p><p>2. <em>Middleware Desteği</em></p><p>Zustand, middleware kullanımını destekler. Bu sayede örneğin persist, devtools, immer gibi eklentilerle store’unuzu kolayca genişletebilirsiniz:</p><pre>import { create } from &#39;zustand&#39;;<br>import { persist } from &#39;zustand/middleware&#39;;<br><br>const useStore = create(<br>  persist(<br>    (set) =&gt; ({<br>      theme: &#39;light&#39;,<br>      toggleTheme: () =&gt;<br>        set((state) =&gt; ({ theme: state.theme === &#39;light&#39; ? &#39;dark&#39; : &#39;light&#39; })),<br>    }),<br>    { name: &#39;theme-storage&#39; }<br>  )<br>);</pre><p>Bu örnekte state, localStorage’a kaydedilir. Sayfa yenilendiğinde veriler korunur.</p><p>3. <em>Async Actions</em></p><p>Zustand ile asenkron işlemler yapmak son derece kolaydır. set fonksiyonu içerisinde async/await kullanabilirsiniz:</p><pre>const useUserStore = create((set) =&gt; ({<br>  user: null,<br>  fetchUser: async () =&gt; {<br>    const res = await fetch(&#39;/api/user&#39;);<br>    const data = await res.json();<br>    set({ user: data });<br>  },<br>}));</pre><p>4. <em>Store Yapılandırmasını Parçalama</em></p><p>Store’unuzu modüllere bölerek organize bir yapı kurabilirsiniz. Özellikle büyük uygulamalarda farklı concern’lere (auth, cart, theme, vs.) özel store tanımlamak oldukça pratiktir.</p><pre>// store/authStore.js<br>// store/cartStore.js<br>// store/themeStore.js</pre><h4>Sonuç</h4><p>Zustand, React dünyasında state yönetimini karmaşadan uzaklaştıran ve modern ihtiyaçlara cevap veren hafif ama güçlü bir kütüphane. Basit projelerden büyük ölçekli uygulamalara kadar geniş bir yelpazede kullanılabilir. Context karmaşasına girmeden, minimum boilerplate ile etkili bir global state yönetimi sunar.</p><p>React ile geliştirme yaparken sade ve performanslı bir çözüm arıyorsanız Zustand’a mutlaka göz atmalısınız.</p><h4>Referanslar</h4><p><a href="https://zustand.docs.pmnd.rs/getting-started/introduction">Introduction - Zustand</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d046b354eb9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers-tr/zustand-ile-global-state-y%C3%B6netimine-modern-bir-yakla%C5%9F%C4%B1m-8d046b354eb9">Zustand ile Global State Yönetimine Modern Bir Yaklaşım</a> was originally published in <a href="https://medium.com/huawei-developers-tr">Huawei Developers - Türkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React JS — İsimlendirme Kuralları]]></title>
            <link>https://medium.com/huawei-developers-tr/react-js-i%CC%87simlendirme-kurallar%C4%B1-c2aa91e10216?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2aa91e10216</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 05:34:16 GMT</pubDate>
            <atom:updated>2024-08-15T05:34:16.566Z</atom:updated>
            <content:encoded><![CDATA[<h3>React JS — İsimlendirme Kuralları</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KoJEVkRh9iaiJf3p71I1Tw.png" /><figcaption>React JS İsimlendirme Kuralları</figcaption></figure><h4>Giriş</h4><p>Bu makalede isimlendirme kurallarına neden ihtiyacımız olduğuna, isimlendirme kurallarının neler olduğuna ve bu kuralların React özelinde nasıl kullanılacağına değineceğiz.</p><h4>İsimlendirme Kurallarına Neden İhtiyacımız Var?</h4><p>İsimlendirme kuralları, dosyaları, değişkenleri, fonksiyonları, sınıfları veya diğer varlıkları tutarlı ve anlamlı bir şekilde adlandırmak için kullanılan bir dizi kural veya kılavuzdur. İsimlendirme kuralları kodun okunabilirliğini, sürdürülebilirliğini ve ekip üyeleri arasındaki işbirliğini geliştirdiği için önemlidir.</p><p>React Js’de isimlendirme kuralları söz konusu olduğunda, tutarlılık ve netlik çok önemlidir.</p><p>İyi tanımlanmış bir isimlendirme kuralı, kodun okunabilirliğini, sürdürülebilirliğini ve işbirliğini geliştirmeye yardımcı olur.</p><p>İsimlendirme için kullanabileceğimiz yaygın olarak tercih edilen bazı kalıplar şunlardır:</p><ul><li><strong>camelCase:</strong> İlk kelimenin tamamı küçük harflerle yazılır. Sonraki her kelimenin ilk harfi büyük harfle başlar.</li></ul><pre>const kullaniciAdi = &#39;isim&#39;</pre><ul><li><strong>PascalCase:</strong> Her kelimenin ilk harfi büyük harfle başlar. Bu, camelCase’den farklı olarak ilk kelime de büyük harfle başlar.</li></ul><pre>const KullaniciAdi = &#39;isim&#39;</pre><ul><li><strong>snake_case: </strong>Tüm kelimeler küçük harflerle yazılır ve kelimeler arasına alt çizgi (_) konur.</li></ul><pre>const kullanici_adi = &#39;isim&#39;</pre><ul><li><strong>kebab-case: </strong>Tüm kelimeler küçük harflerle yazılır ve kelimeler arasına kısa çizgi (-) konur. Genellikle URL’ler ve bazı dosya isimlerinde kullanılır.</li></ul><pre>const kullanici-adi = &#39;isim&#39;</pre><h4>İsimlendirme Kuralları</h4><h4>Bileşenler</h4><p>React bileşenleri için açıklayıcı ve anlamlı isimler kullanın. Bileşen isimleri için PascalCase kullanın.</p><pre>// React bileseni ✔️<br>const ExampleItem= () =&gt; {<br>...<br>}<br><br>// React bileseni ❌<br>const exampleItem= () =&gt; {<br>...<br>}<br><br>// Typescript interface ✔️<br>interface ExampleItem{<br>  id: number;<br>  name: string;<br>}<br><br>// Typescript interface ❌<br>interface exampleItem{<br>  id: number;<br>  name: string;<br>}</pre><h4>Dosyalar</h4><p>Dosyalarınızı bileşen adıyla eşleşen PascalCase kullanarak adlandırın. Örneğin, ExampleCard adında bir bileşeniniz varsa, dosyanın adı ExampleCard.jsx olmalıdır.</p><pre>// React dosyasi ✔️<br>ExampleCard.jsx <br><br>// React dosyasi ❌<br>exampleCard.jsx<br>example-card.jsx<br>example_card.jsx</pre><h4>Proplar</h4><p>Amaçlarını açıkça belirtmek için aksesuarlar için tanımlayıcı isimler kullanın. Projeniz bağlamında yaygın olarak anlaşılmadıkları sürece kısaltmalardan kaçının.</p><pre>import React from &#39;react&#39;;<br><br>// Child bileşen: Kullanıcı bilgilerini gösteren bir bileşen.<br>function UserInfo(props) {<br>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;{props.name}&lt;/h2&gt;<br>      &lt;p&gt;{props.email}&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>// Main bileşen: Kullanıcı bilgilerini içeren bir bileşen.<br>function App() {<br>  const user = {<br>    name: &#39;kullanici&#39;,<br>    email: &#39;kullanici@example.com&#39;,<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;Kullanıcı Bilgileri&lt;/h1&gt;<br>      &lt;UserInfo name={user.name} email={user.email} /&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>‘UserInfo’ ve ‘user’ gibi açıklayıcı isimler kullanarak, prop’un kullanıcı verilerini temsil ettiği açıktır ve bu da kodu daha okunabilir ve anlaşılabilir hale getirir.</p><h4>State Değişkenleri</h4><p>Boolean değerleri belirtmek için durum değişkenlerinin önüne is, has veya should ekleyin.</p><pre>import { useState } from &#39;react&#39;;<br><br>const ExampleComponent = () =&gt; {<br>  const [isActive, setIsActive] = useState(true); // ✔️<br>  const [hasError, setHasError] = useState(false); // ✔️<br>  const [shouldRender, setShouldRender] = useState(true); // ✔️<br><br>  const [active, setActive] = useState(true); // ❌<br>  const [error, setError] = useState(false); // ❌<br>  const [render, setRender] = useState(true); // ❌<br><br>  const handleClick = () =&gt; {<br>    setIsActive(!isActive);<br>  }<br><br>  return (<br>    &lt;div&gt;<br>      {shouldRender &amp;&amp; (<br>      &lt;div className={isActive ? &#39;active&#39; : &#39;inactive&#39;}&gt;<br>        &lt;button onClick={handleClick}&gt;<br>          {isActive ? &#39;active&#39; : &#39;inactive&#39;}<br>        &lt;/button&gt;<br>        {hasError &amp;&amp; &lt;p&gt;An error occured.&lt;/p&gt;}<br>        &lt;/div&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default ExampleComponent;</pre><p>Adlandırma kuralını takip ederek, bu durum değişkenlerinin amacı ve anlamı netleşir, böylece kod daha okunabilir ve sürdürülebilir hale gelir.</p><h4>Event Handlers</h4><p>Eventler için <strong><em>handle </em></strong>öğesini ön ek olarak kullanın ve isimlendirme için camelCase kalıbını tercih edin.</p><p>Örneğin, handleSubmit, handleClick, handleLogout, handleInputChange.</p><pre>import { useState } from &quot;react&quot;;<br><br>function ExampleComponent() {<br>  const [isActive, setIsActive] = useState(true);<br>  <br>  // ✔️<br>  const handleButtonClick = () =&gt; {<br>    setIsActive(!isActive);<br>  };<br><br>  // ❌<br>  const buttonClick = () =&gt; {<br>    setIsActive(!isActive);<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;button onClick={handleButtonClick}&gt;<br>        {isActive ? &quot;active&quot; : &quot;inactive&quot;}<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default ExampleComponent;</pre><h4>Sabit Değişken Tanımlama</h4><p>JavaScript’te sabitleri temsil etmek için UPPER_SNAKE_CASE kullanın.</p><pre>const API_URL = &#39;https://api.example.com&#39;; // ✔️<br>const MAX_RESULT = 10; // ✔️<br><br>const api_url; = &#39;https://api.example.com&#39;; // ❌<br>const max_result = 10; // ❌</pre><h4>Fonksiyonlar</h4><p>Fonksiyon isimleri büyük/küçük harfe duyarlıdır ve küçük harfle başlamalıdır. İsimlendirme için camelCase kullanın. Anlamlı ve genellikle emir kipinde fiiller tercih edin.</p><pre>// ✔️  <br>const getUserData = () =&gt; {<br>    // fonksiyon uygulamaları<br>    return userData;<br>  };<br><br>  const fetchOrders = () =&gt; {<br>    // fonksiyon uygulamaları<br>    return orders;<br>  };<br><br>// ❌<br>const UserData = () =&gt; {<br>    // fonksiyon uygulamaları<br>    return userData;<br>  };<br><br>  const FetchOrders = () =&gt; {<br>    // fonksiyon uygulamaları<br>    return orders;<br>  };</pre><h4>Sonuç</h4><p>Sonuç olarak, React projelerinde tutarlı ve anlamlı bir isimlendirme standardı uygulamak, kodun okunabilirliğini ve sürdürülebilirliğini artırır. camelCase gibi yaygın konvansiyonları kullanmak, hem bireysel geliştiriciler hem de ekipler için daha verimli bir çalışma ortamı sağlar. Bu basit kurallara uyarak, daha temiz ve anlaşılır bir kod yapısı elde edilebilir.</p><h4>Referanslar</h4><ul><li><a href="https://www.30secondsofcode.org/cheatsheets/p/1/">Cheatsheets - 30 seconds of code</a></li><li><a href="https://react.dev/">React</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2aa91e10216" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers-tr/react-js-i%CC%87simlendirme-kurallar%C4%B1-c2aa91e10216">React JS — İsimlendirme Kuralları</a> was originally published in <a href="https://medium.com/huawei-developers-tr">Huawei Developers - Türkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React JS — Naming Conventions]]></title>
            <link>https://medium.com/huawei-developers/react-js-naming-conventions-fe87bc9dbd9a?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe87bc9dbd9a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 05:31:45 GMT</pubDate>
            <atom:updated>2024-08-15T05:31:45.423Z</atom:updated>
            <content:encoded><![CDATA[<h3>React JS — Naming Conventions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SlHdTVJf8oMpfQgQtKDWQg.png" /><figcaption>React JS Naming Conventions</figcaption></figure><h4>Introduction</h4><p>In this article, we will cover the reasons for needing naming conventions, what these conventions are, and how they can be applied specifically to React.</p><h4>Why Do We Need Naming Conventions?</h4><p>Naming conventions are a set of rules or guidelines used to name files, variables, functions, classes, or other entities in a consistent and meaningful way. They are important because they improve code readability, maintainability, and collaboration among team members. In React JS, consistency and clarity are crucial for naming conventions.</p><p>A well-defined naming convention helps enhance the readability, maintainability, and collaboration of the code. Some commonly used naming patterns include:</p><ul><li><strong>camelCase</strong>: The first word is in lowercase, and each subsequent word starts with an uppercase letter.</li></ul><pre>const userName= &#39;name&#39;</pre><ul><li><strong>PascalCase</strong>: Every word starts with an uppercase letter, including the first word.</li></ul><pre>const UserName= &#39;name&#39;</pre><ul><li><strong>snake_case</strong>: All words are in lowercase and separated by underscores (_).</li></ul><pre>const user_name = &#39;name&#39;</pre><ul><li><strong>kebab-case</strong>: All words are in lowercase and separated by hyphens (-). Typically used for URLs and some file names.</li></ul><pre>const user-name = &#39;name&#39;</pre><h4>Naming Conventions</h4><h4>Components</h4><p>Use descriptive and meaningful names for React components. For component names, use PascalCase.</p><pre>// React component ✔️<br>const ExampleItem = () =&gt; {<br>  ...<br>};<br><br>// React component ❌<br>const exampleItem = () =&gt; {<br>  ...<br>};<br><br>// Typescript interface ✔️<br>interface ExampleItem {<br>  id: number;<br>  name: string;<br>}<br><br>// Typescript interface ❌<br>interface exampleItem {<br>  id: number;<br>  name: string;<br>}</pre><h4>Files</h4><p>Name your files using PascalCase that matches the component name. For example, if you have a component named ExampleCard, the file should be named ExampleCard.jsx.</p><pre>// React file ✔️<br>ExampleCard.jsx <br><br>// React file ❌<br>exampleCard.jsx<br>example-card.jsx<br>example_card.jsx</pre><h4>Props</h4><p>Use descriptive names for props to clearly indicate their purpose. Avoid abbreviations unless they are widely understood in the context of your project.</p><pre>import React from &#39;react&#39;;<br><br>// Child component: Component that displays user information.<br>function UserInfo(props) {<br>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;{props.name}&lt;/h2&gt;<br>      &lt;p&gt;{props.email}&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>// Main component: Component containing user information.<br>function App() {<br>  const user = {<br>    name: &#39;user&#39;,<br>    email: &#39;user@example.com&#39;,<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;User Information&lt;/h1&gt;<br>      &lt;UserInfo name={user.name} email={user.email} /&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>Using descriptive names like ‘UserInfo’ and ‘user’ makes it clear that the prop represents user data, enhancing readability and understandability.</p><h4>State Variables</h4><p>For boolean state variables, prefix them with is, has, or should.</p><pre>import { useState } from &#39;react&#39;;<br><br>const ExampleComponent = () =&gt; {<br>  const [isActive, setIsActive] = useState(true); // ✔️<br>  const [hasError, setHasError] = useState(false); // ✔️<br>  const [shouldRender, setShouldRender] = useState(true); // ✔️<br><br>  const [active, setActive] = useState(true); // ❌<br>  const [error, setError] = useState(false); // ❌<br>  const [render, setRender] = useState(true); // ❌<br><br>  const handleClick = () =&gt; {<br>    setIsActive(!isActive);<br>  }<br><br>  return (<br>    &lt;div&gt;<br>      {shouldRender &amp;&amp; (<br>        &lt;div className={isActive ? &#39;active&#39; : &#39;inactive&#39;}&gt;<br>          &lt;button onClick={handleClick}&gt;<br>            {isActive ? &#39;active&#39; : &#39;inactive&#39;}<br>          &lt;/button&gt;<br>          {hasError &amp;&amp; &lt;p&gt;An error occurred.&lt;/p&gt;}<br>        &lt;/div&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default ExampleComponent;</pre><p>By following the naming convention, the purpose and meaning of these state variables become clearer, making the code more readable and maintainable.</p><h4>Event Handlers</h4><p>Use the prefix handle for event handlers and prefer camelCase for naming. For example, handleSubmit, handleClick, handleLogout, handleInputChange.</p><pre>import { useState } from &quot;react&quot;;<br><br>function ExampleComponent() {<br>  const [isActive, setIsActive] = useState(true);<br><br>  // ✔️<br>  const handleButtonClick = () =&gt; {<br>    setIsActive(!isActive);<br>  };<br><br>  // ❌<br>  const buttonClick = () =&gt; {<br>    setIsActive(!isActive);<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;button onClick={handleButtonClick}&gt;<br>        {isActive ? &quot;active&quot; : &quot;inactive&quot;}<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default ExampleComponent;</pre><h4>Constant Variables</h4><p>Use UPPER_SNAKE_CASE to represent constants in JavaScript.</p><pre>const API_URL = &#39;https://api.example.com&#39;; // ✔️<br>const MAX_RESULT = 10; // ✔️<br><br>const api_url = &#39;https://api.example.com&#39;; // ❌<br>const max_result = 10; // ❌</pre><h4>Functions</h4><p>Function names are case-sensitive and should start with a lowercase letter. Use camelCase for naming. Prefer meaningful names and typically use imperative verbs.</p><pre>// ✔️  <br>const getUserData = () =&gt; {<br>    // function implementation<br>    return userData;<br>};<br><br>const fetchOrders = () =&gt; {<br>    // function implementation<br>    return orders;<br>};<br><br>// ❌<br>const UserData = () =&gt; {<br>    // function implementation<br>    return userData;<br>};<br><br>const FetchOrders = () =&gt; {<br>    // function implementation<br>    return orders;<br>};</pre><h4>Conclusion</h4><p>In summary, applying consistent and meaningful naming conventions in React projects enhances code readability and maintainability. Using conventions such as camelCase helps create a more efficient working environment for both individual developers and teams. By adhering to these simple rules, you can achieve a cleaner and more understandable code structure.</p><h4>References</h4><ul><li><a href="https://www.30secondsofcode.org/cheatsheets/p/1/">Cheatsheets - 30 seconds of code</a></li><li><a href="https://react.dev/">React</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe87bc9dbd9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/huawei-developers/react-js-naming-conventions-fe87bc9dbd9a">React JS — Naming Conventions</a> was originally published in <a href="https://medium.com/huawei-developers">Huawei Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node Version Manager — NVM]]></title>
            <link>https://utkukaba.medium.com/node-version-manager-nvm-3ea115842466?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ea115842466</guid>
            <category><![CDATA[node]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 18:03:36 GMT</pubDate>
            <atom:updated>2024-02-26T18:03:36.000Z</atom:updated>
            <content:encoded><![CDATA[<h3>Node Version Manager — NVM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ft8vscKkg4KZkbMqP9Uy0w.jpeg" /><figcaption>Node Version Manager</figcaption></figure><h3>What is NVM?</h3><p>Node Version Manager (NVM) is a tool used to manage multiple active Node versions. Node frameworks are rapidly evolving frameworks. What might work under one Node version is not guaranteed to work for another version of Node. Therefore, users need ways to switch between multiple versions of Node. At this point, NVM allows you to install different versions of Node, and switch between these versions depending on the project that you’re working on via the command line.</p><h3>NVM Installation and Usage</h3><p>As for how to install NVM, there are different ways to do it. Firstly we need to download the latest NVM installation file using the link below.</p><p>In the <a href="https://github.com/coreybutler/nvm-windows#readme">nvm-windows repository Readme</a>, click on “Download Now!”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*mVk24eAWCshNRz5X_jXynw.png" /><figcaption>Nvm Windows Repository</figcaption></figure><p>In the latest release, you’ll find different assets. Click on the <strong>nvm-setup.exe</strong> asset which is the installation file for the tool.</p><p>Open the file that you have downloaded, and complete the installation wizard. When done, you can confirm that nvm has been installed by running:</p><pre>nvm -v || nvm --version</pre><p>If nvm was installed correctly, this command will show you the nvm version installed.</p><h3>NVM Basic Commands</h3><p>With nvm installed, you can now install, uninstall, and switch between different Node versions in your Windows, Linux, or Mac device.</p><ul><li>You can install Node versions:</li></ul><pre>nvm install vX.Y.Z</pre><ul><li>You can install latest LTS version of node (Long Term Support):</li></ul><pre>nvm install --lts</pre><ul><li>You can list locally installed versions of node:</li></ul><pre>nvm list || nvm ls</pre><ul><li>You can list remove available versions of node:</li></ul><pre>nvm list available || nvm ls-remote</pre><ul><li>You want to use a specific version at any point, you can run the following in your terminal:</li></ul><pre>nvm use vA.B.C</pre><ul><li>You can set default version of node:</li></ul><pre>nvm alias default vX.Y.Z</pre><ul><li>To launch a file with a specific version without setting it default:</li></ul><pre>nvm run vA.B.C index.js</pre><ul><li>You can uninstall a version of Node:</li></ul><pre>nvm uninstall vX.Y.Z</pre><h3>Where to go from here</h3><p>Now we are more aware of what NVM is and why it is used. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ea115842466" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React JS Form Validation using Yup]]></title>
            <link>https://utkukaba.medium.com/react-js-form-validation-using-yup-31a0493e1fa6?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/31a0493e1fa6</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[validation]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 15:23:13 GMT</pubDate>
            <atom:updated>2024-08-14T11:28:23.901Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="react yup validation" src="https://cdn-images-1.medium.com/max/200/1*wVdy5u_Azs6X1I4jP8Svig.jpeg" /></figure><p>In this article we will learn why you should be using Yup in your React projects, what it does exactly, with examples.</p><p>Yup is a Javascript schema builder for value parsing and validation. It allows you to create a schema, validate data against that schema, and then use the validated data. This schema can include the type of each field, as well as any validation rules that should be applied to that field.</p><p>It can be used in both client-side and server-side applications.</p><h4>Why should we use Yup?</h4><p>Web apps built on JavaScript Frameworks are now highly interactive and mutable. With this comes a large amount of data exchange, whether it be from API requests, form submissions, or custom objects to handle our state.</p><p>Therefore, we need to make sure that we have the right access to this mutable and large amount of data and that we are filtering correctly. And this is where <em>Yup</em> comes into play.</p><p>In addition, we prefer Yup validation for reasons such as;</p><ol><li>Keeping individual states of each form element and managing their change.</li><li>Prolonge verification processes.</li><li>Conversion of spaghetti to code due to repetitive codes and moving away from the concept of clean code.</li></ol><p>Yup provides for validating the data our apps consume and manipulate, in an abstract way that does not interfere with the rest of our business logic.</p><h4>Installing Yup in React Projects</h4><p>We can install using the following command:</p><pre>npm i yup</pre><h4>Importing Yup</h4><p>Yup has the flexibility to be imported as an entire library, or as separate components that only your component needs.</p><p>Import the entire library with:</p><pre>import * as yup from &#39;yup&#39;;</pre><h4>Yup Schema Basics</h4><p>It all starts by defining schema, and yup comes with a whole range of built-in, flexible, options for basic types, and options to build more complex ones.</p><pre>const schema = yub.object().shape({<br>  //object schema<br>});</pre><p>In the code above, the result is yup schema. The parameter of the shape function is an empty object, so it does not test anything, but this is where you would pass validation details for your data. For that, let’s consider the next values and build a validation object for them.</p><pre>const schema = yup.object().shape({<br>  firstName: yup.string(),<br>  lastName: yup.string(),<br>  age: yup.number(),<br>  email: yup.string(),<br>  created: yup.date(),<br>});</pre><p>Once we have both data and schema defined, data can be tested. For that, our schema has an isValid function that returns a promise that resolves with Boolean status.</p><pre>const valid = schema.isValid(data).then((valid) =&gt; {<br>  console.log(valid); // true<br>});</pre><h4>Yup Schema Example</h4><p>We will create new schema object with <em>Yup</em>. This schema will define all values (form fields) we want to validate. These values will be <em>e-mail</em>, <em>password</em>, <em>repeat</em> <em>password</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*8lWz9lIn_tBDtLhCn9cgxQ.png" /><figcaption>Sign up form</figcaption></figure><p>We will want all these values to be string() and required(). We will specify the <em>e-mail</em> value to match email format, with email().</p><pre>const EmailSchema = Yup.object().shape({<br>    email: Yup.string()<br>      .email()<br>      .required(&quot;Required.&quot;)<br>})</pre><p>We will also specify that password has to be at least 8 characters long with min(8). And also specify that password must to include at least one number, at least one lowercase character, at least one uppercase character and at least one symbols.</p><pre>const PasswordSchema = Yup.object().shape({<br>    password: Yup.string()<br>      .min(8, &quot;You must enter at least 8 characters.&quot;)<br>      .matches(/[0-9]/, &quot;You must enter at least one number.&quot;)<br>      .matches(/[a-z]/, &quot;You must enter at least one lowercase letter.&quot;)<br>      .matches(/[A-Z]/, &quot;You must enter at least one uppercase letter.&quot;)<br>      .matches(/[#?!@$%^&amp;*-]/, &quot;You must enter at least one symbols.&quot;)<br>      .required(&quot;Required.&quot;)<br>})</pre><p>All of these criteria will also be in the <em>repeat password</em> section. But in addition to these, we need to check whether it matches the password entered <em>password</em> section. We can use the oneOf parameter for this.</p><pre>const PasswordSchema = Yup.object().shape({<br>    password: Yup.string()<br>      .min(8, &quot;You must enter at least 8 characters.&quot;)<br>      .matches(/[0-9]/, &quot;You must enter at least one number.&quot;)<br>      .matches(/[a-z]/, &quot;You must enter at least one lowercase letter.&quot;)<br>      .matches(/[A-Z]/, &quot;You must enter at least one uppercase letter.&quot;)<br>      .matches(/[#?!@$%^&amp;*-]/, &quot;You must enter at least one symbols.&quot;)<br>      .required(&quot;Required.&quot;)<br>    repeatPassword: Yup.string()<br>      .oneOf([Yup.ref(&#39;password&#39;)], &quot;Passwords must match.&quot;)<br>      .required(&quot;Required.&quot;)<br>})</pre><p>We have thus completed a simple yup validation example.</p><h4>Where to go from here</h4><p>Now we should have a solid understanding of what Yup is, why it is used, and perhaps some ideas on how it can be implemented in our projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31a0493e1fa6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript Dizi (Array) Metotları — 1]]></title>
            <link>https://utkukaba.medium.com/javascript-dizi-array-metotlar%C4%B1-1-f763bfcce2a?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f763bfcce2a</guid>
            <category><![CDATA[array-methods]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Fri, 10 Feb 2023 12:14:42 GMT</pubDate>
            <atom:updated>2024-08-14T11:26:12.608Z</atom:updated>
            <content:encoded><![CDATA[<h3>Javascript Dizi (Array) Metotları — 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*YJb6KIeRdHOV-AdpAK9Heg.jpeg" /><figcaption>Javascript Array Methods</figcaption></figure><p>Bu yazı serisinde Javascript dilinde dizi nesneleri ile tanımlanan metotlar yaptıkları işlevlere göre sınıflandırılıp anlatılacaktır. Bu metotlar sayesinde diziler ile çalışırken daha kısa ve verimli kodlar yazmamız mümkün olacaktır. Bu metotları kullanmadan önce tarayıcı destek durumlarını kontrol etmenizde fayda vardır.</p><h4>Dizi elemanları üzerinde düzenleme işlemi yapan metotlar</h4><ol><li><strong><em>pop()</em></strong></li></ol><p>Bu metot dizi içerisindeki en son elemanı siler ve sildiği elemanın değerini geri döndürür.</p><pre>const myFish = [&quot;angel&quot;, &quot;clown&quot;, &quot;mandarin&quot;, &quot;sturgeon&quot;];<br><br>const popped = myFish.pop();<br><br>console.log(myFish); // Expected output: [&#39;angel&#39;, &#39;clown&#39;, &#39;mandarin&#39; ]<br><br>console.log(popped); // Expected output: &#39;sturgeon&#39;</pre><p>2. <strong><em>push()</em></strong></p><p>Bir dizinin sonuna bir ya da daha fazla eleman eklemek için kullanılan metotdur.</p><pre>const animals = [&#39;pigs&#39;, &#39;goats&#39;, &#39;sheep&#39;];<br><br>const count = animals.push(&#39;cows&#39;);<br><br>console.log(count); // Expected output: 4<br><br>console.log(animals); // Expected output: Array [&quot;pigs&quot;, &quot;goats&quot;, &quot;sheep&quot;, &quot;cows&quot;]</pre><p>3. <strong><em>reverse()</em></strong></p><p>Bu metot dizi içersindeki sıralamayı ters çevirir. Bu metot geriye yeni oluşturulan dizi nesnesini döndürür. Buradaki dikkat edilecek nokta bu metotun orijinal diziyi değiştirdiğidir.</p><pre>const reversed = array1.reverse();<br><br>console.log(&#39;reversed:&#39;, reversed);<br>// Expected output: &quot;reversed:&quot; Array [&quot;three&quot;, &quot;two&quot;, &quot;one&quot;]<br><br>console.log(&#39;array1:&#39;, array1);<br>// Expected output: &quot;array1:&quot; Array [&quot;three&quot;, &quot;two&quot;, &quot;one&quot;]</pre><p>4. <strong><em>shift()</em></strong></p><p>Bu metot dizi içerisindeki ilk elemanı (indeksi 0 olan eleman) siler. Geriye sildiği elemanın değerini döndürür.</p><pre>const array1 = [1, 2, 3];<br><br>const firstElement = array1.shift();<br><br>console.log(array1);<br>// Expected output: Array [2, 3]<br><br>console.log(firstElement);<br>// Expected output: 1</pre><p>5. <strong><em>unshift()</em></strong></p><p>Bu metot bir dizinin başına bir ya da daha fazla eleman eklemek için kullanılır. Geriye yeni oluşan dizinin uzunluğunu döndürür.</p><pre>const array1 = [1, 2, 3];<br><br>console.log(array1.unshift(4, 5));<br>// Expected output: 5<br><br>console.log(array1);<br>// Expected output: Array [4, 5, 1, 2, 3]</pre><p>6. <strong><em>sort()</em></strong></p><p>Bir dizideki elemanları sıralamak için kullanılır. Bu metot yeni bir dizi nesnesi oluşturmaz, iletilen diziyi sıralar. Bu metot hakkında önemli bir nokta ise sıralamaları Unicode kod karakterleri sırasına göre karşılaştırarak sıralama yapmasıdır. O yüzden bu metotu direkt olarak sayılar için kullanmak beklenmedik bir sonuç getirir.</p><pre>const months = [&#39;March&#39;, &#39;Jan&#39;, &#39;Feb&#39;, &#39;Dec&#39;];<br><br>months.sort();<br><br>console.log(months);<br>// Expected output: Array [&quot;Dec&quot;, &quot;Feb&quot;, &quot;Jan&quot;, &quot;March&quot;]</pre><pre>const array1 = [1, 30, 4, 21, 100000];<br><br>array1.sort();<br><br>console.log(array1);<br>// Expected output: Array [1, 100000, 21, 30, 4]</pre><p>Yukarıdaki kod örneğinde gördüğümüz gibi sayıları karakter olarak algılayıp sıralama yapmıştır. Bu da bizim beklediğimizin dışında bir dönüt oluşturmuştur. Bunun çözümü ise karşılaştırma fonksiyonu kullanarak sıralama yaptırmaktır.</p><pre>const numbers = [5, 25, 14];<br><br>numbers.sort(function(a, b){return a - b});<br><br>console.log(numbers)// 5, 14, 25<br><br>const numbers2 = [5, 25, 14];<br><br>numbers2.sort(function(a, b){return b - a});<br><br>console.log(numbers2) //[25, 14, 5]</pre><p>7. <strong><em>splice()</em></strong></p><p>Bir diziye eleman eklemek ya da diziden eleman silmek için kullanılan metottur. Bu metot, diziden eleman silme anında diziye yeni elemanları ekleme imkanı sağlamaktadır.</p><pre>array.splice(start)<br>array.splice(start, deleteCount)<br>array.splice(start, deleteCount, item1)</pre><pre>const months = [&#39;Jan&#39;, &#39;March&#39;, &#39;April&#39;, &#39;June&#39;];<br><br>months.splice(1, 0, &#39;Feb&#39;);<br>// Inserts at index 1<br><br>console.log(months);<br>// Expected output: Array [&quot;Jan&quot;, &quot;Feb&quot;, &quot;March&quot;, &quot;April&quot;, &quot;June&quot;]<br><br>months.splice(4, 1, &#39;May&#39;);<br>// Replaces 1 element at index 4<br><br>console.log(months);<br>// Expected output: Array [&quot;Jan&quot;, &quot;Feb&quot;, &quot;March&quot;, &quot;April&quot;, &quot;May&quot;]</pre><p>Bu yazımda işinize yarayabilecek ve bilmenizde fayda olduğunu düşündüğüm dizi elemanları üzerinde düzenleme işlemi yapabileceğiniz Javascript metotlarından kısaca bahsetmeye çalıştım.</p><p>İyi çalışmalar.</p><h4>Kaynakça</h4><ol><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array</a></li><li><a href="https://www.w3schools.com/js/js_array_methods.asp">https://www.w3schools.com/js/js_array_methods.asp</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f763bfcce2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Makine Öğrenmesi Nedir? Kısa bir okuma.]]></title>
            <link>https://utkukaba.medium.com/makine-%C3%B6%C4%9Frenmesi-nedir-k%C4%B1sa-bir-okuma-605b83fd2aff?source=rss-416442f079a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/605b83fd2aff</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[makine-öğrenmesi]]></category>
            <category><![CDATA[yapay-zeka]]></category>
            <dc:creator><![CDATA[Utku Kaba]]></dc:creator>
            <pubDate>Tue, 30 Nov 2021 17:29:18 GMT</pubDate>
            <atom:updated>2021-11-30T17:29:18.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*iPFEzWcE0NxB62P7gx8j5A.jpeg" /></figure><h3><strong>Makine Öğrenmesi</strong></h3><p>Makine öğrenmesi, sistemin geçmişteki deneyimlerinden elde edilen öğrenmelerini kullanarak bir model oluşturması ve gelecekteki karşılaşacağı durumlar karşısında bir tahminde bulunmasını sağlayan bir yapay zeka alanıdır. Bilgisayarın eldeki veriler üzerinden geliştirilen bir model yardımıyla oluşturdukları öğrenmeleri, ileride karşılaştıkları yeni veriler üzerinde kullanarak kararlar verebilmesini ve ilgili problemlere çözümler üretmesi olarak tanımlanabilir.</p><p>Bir makine öğrenmesi görevinin gerçekleştirilmesi için beş temel adım vardır. Bunlar:</p><ol><li>Veri toplama (Collecting data)</li><li>Verilerin hazırlanması (Preparing the data)</li><li>Modeli eğitmek (Training a model)</li><li>Modelin değerlendirilmesi (Evaluating the model)</li><li>Performansı değerlendirmek ve artırmak (Improving the performance)</li></ol><p>Makine öğrenmesinin amaçları üç açıdan incelenebilir: [<em>Machine learning : paradigms and methods</em>, Carbonell, 1989]</p><ol><li><strong>Hedef Tabanlı Çalışmalar: </strong>“Öğrenme sisteminin gelişimi ve analizi, belirlenmiş görevleri yerine getirmek için gerçekleştirilir. Bu yaklaşım, makine öğrenmesinin mühendislik yaklaşımı olarak tanımlanmıştır.”</li><li><strong>Bilişsel Simülasyon: </strong>“İnsanın öğrenme sürecini araştırıp bilgisayar ortamında benzetimini gerçekleştirmek olarak tanımlanmıştır. Bu ise, makine öğrenmesinin bilişsel modelleme yaklaşamıdır.”</li><li><strong>Teorik Analiz: </strong>“Uygulama alanlarından bağımsız olarak teorik olabilecek öğrenme metotları ve ve algoritmaları incelemek içindir.”</li></ol><h3><strong>Makine Öğrenmesi Algoritma Türleri</strong></h3><p>Makine öğrenmesi algoritmaları eldeki verileri kullanarak en iyi modeli oluşturmaya çalışırlar. Yeni veriler geldiğinde önceki verilerle oluşturulan modeli kullanarak yeni gelen verileri analiz etmeye çalışırlar. Eldeki verilerin işlenerek içerisinden anlamlı ve kullanışlı bilgilerin oluşturulmasına veri madenciliği denir denilmektedir. [<em>Makine Öğrenmesi Yöntemlerinin Polisomnografik Verilere Uyarlanması</em>, Güven Çentik, 2013]</p><ol><li><strong>Denetimli Öğrenme:</strong> Basit bir makine öğrenimi modelinde öğrenme süreci iki adıma ayrılır: eğitim ve test. Eğitim sürecinde, öğrenme algoritması veya öğrenen tarafından özelliklerin öğrenildiği ve öğrenme modelinin oluşturulduğu eğitim verilerindeki örnekler girdi olarak alınır. Test sürecinde, öğrenme modeli, test veya üretim verileri için tahmin yapmak için yürütme motorunu kullanır. Etiketlenmiş veriler, nihai tahmini veya sınıflandırılmış verileri veren öğrenme modelinin çıktısıdır.</li><li><strong>Denetimsiz Öğrenme:</strong> Denetimsiz öğrenme, verilerdeki ilişkileri tanımlamak veya çıkarmak için bir model kullanmayı içeren bir sorun sınıfını tanımlar. Denetimli öğrenme ile karşılaştırıldığında, denetimsiz öğrenme, çıktılar veya hedef değişkenler olmadan yalnızca girdi verileri üzerinde çalışır. Bu nedenle, denetimsiz öğrenme, denetimli öğrenme durumunda olduğu gibi modeli düzelten bir öğretmene sahip değildir.</li><li><strong>Yarı-Denetimli Öğrenme:</strong> Yarı denetimli öğrenme, eğitim verilerinin çok az etiketli örnek ve çok sayıda etiketlenmemiş örnek içerdiği denetimli öğrenmedir. Yarı denetimli öğrenme modelinin amacı, denetimli öğrenmede olduğu gibi yalnızca etiketlenmiş verileri değil, mevcut tüm verileri etkili bir şekilde kullanmaktır.</li><li><strong>Takviyeli Öğrenme:</strong> Takviyeli öğrenme, bir aracının bir ortamda çalıştığı ve geri bildirim kullanarak çalışmayı öğrenmesi gereken bir problem sınıfını tanımlar.</li></ol><p>Bu yazı sadece makine öğrenmesi hakkında genel bilgiler içermektedir. Araştırma yapmak isteyenlere önayak olması amacıyla yazılmıştır.</p><p>Yazıyı beğendiyseniz <a href="https://medium.com/">Medium</a> üzerinden takip ederek desteğinizi gösterebilirsiniz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=605b83fd2aff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>