{"id":32972,"date":"2025-10-28T01:40:52","date_gmt":"2025-10-27T22:40:52","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=32972"},"modified":"2025-10-28T01:40:52","modified_gmt":"2025-10-27T22:40:52","slug":"reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/","title":{"rendered":"React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f"},"content":{"rendered":"<p><body><\/p>\n<h2>React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f<\/h2>\n<p>React ekosistemi, bile\u015fenler aras\u0131 mant\u0131k payla\u015f\u0131m\u0131 ve yeniden kullan\u0131labilirli\u011fi sa\u011flamak i\u00e7in \u00e7e\u015fitli g\u00fc\u00e7l\u00fc desenler sunar. Bu desenlerden biri olan Y\u00fcksek Mertebeden Bile\u015fenler (Higher-Order Components &#8211; HOCs), React&#8217;in ilk d\u00f6nemlerinden itibaren karma\u015f\u0131k uygulamalarda yayg\u0131n olarak kullan\u0131lm\u0131\u015f ve bir\u00e7ok pop\u00fcler k\u00fct\u00fcphanenin temelini olu\u015fturmu\u015ftur. Her ne kadar Hooks&#8217;un ortaya \u00e7\u0131k\u0131\u015f\u0131yla birlikte HOC&#8217;lar\u0131n kullan\u0131m s\u0131kl\u0131\u011f\u0131 yeni projelerde azalm\u0131\u015f olsa da, React geli\u015ftiricilerinin bu deseni anlamas\u0131, mevcut kod tabanlar\u0131n\u0131 y\u00f6netmek, eski k\u00fct\u00fcphaneleri kullanmak ve React&#8217;in evrimini kavramak a\u00e7\u0131s\u0131ndan hayati \u00f6neme sahiptir. Bu makalede, HOC&#8217;lar\u0131n ne oldu\u011funu, neden kullan\u0131ld\u0131klar\u0131n\u0131, nas\u0131l olu\u015fturulduklar\u0131n\u0131, avantajlar\u0131n\u0131, dezavantajlar\u0131n\u0131 ve g\u00fcn\u00fcm\u00fczdeki yerini detayl\u0131 bir \u015fekilde inceleyece\u011fiz.<\/p>\n<h3>Y\u00fcksek Mertebeden Bile\u015fen (HOC) Nedir?<\/h3>\n<p>Y\u00fcksek Mertebeden Bile\u015fen (Higher-Order Component &#8211; HOC), React API&#8217;sinin bir par\u00e7as\u0131 de\u011fildir; React&#8217;in bile\u015fim \u00f6zelli\u011finden yararlanan bir desendir. Tan\u0131m olarak, bir HOC, bir React bile\u015fenini girdi olarak alan ve geli\u015ftirilmi\u015f \u00f6zelliklere sahip yeni bir React bile\u015feni d\u00f6nd\u00fcren bir fonksiyondur. Bu tan\u0131m, JavaScript&#8217;teki &#8220;Y\u00fcksek Mertebeden Fonksiyonlar&#8221; (Higher-Order Functions) kavram\u0131na benzer. Y\u00fcksek Mertebeden Fonksiyonlar, ba\u015fka fonksiyonlar\u0131 arg\u00fcman olarak alan veya bir fonksiyon d\u00f6nd\u00fcren fonksiyonlard\u0131r (\u00f6rne\u011fin <code>map<\/code>, <code>filter<\/code>, <code>reduce<\/code>). HOC&#8217;lar da ayn\u0131 prensibi bile\u015fenler d\u00fcnyas\u0131na ta\u015f\u0131r.<\/p>\n<p>Basit\u00e7e ifade etmek gerekirse:<\/p>\n<pre><code class=\"language-javascript\">const higherOrderComponent = (WrappedComponent) => {\n  return class extends React.Component {\n    \/\/ Yeni mant\u0131k, durum veya \u00f6zellikler burada eklenebilir\n    render() {\n      return <WrappedComponent {...this.props} \/>;\n    }\n  };\n};<\/code><\/pre>\n<p>Veya fonksiyonel bir bile\u015fen d\u00f6nd\u00fcren haliyle:<\/p>\n<pre><code class=\"language-javascript\">const higherOrderComponent = (WrappedComponent) => {\n  const EnhancedComponent = (props) => {\n    \/\/ Yeni mant\u0131k veya \u00f6zellikler burada eklenebilir\n    return <WrappedComponent {...props} \/>;\n  };\n  return EnhancedComponent;\n};<\/code><\/pre>\n<p>Burada <code>WrappedComponent<\/code>, HOC taraf\u0131ndan sar\u0131lan orijinal bile\u015fendir. HOC, bu <code>WrappedComponent<\/code>&#8216;i al\u0131r ve genellikle ona ek \u00f6zellikler (props), durum (state) veya davran\u0131\u015flar ekleyerek yeni bir bile\u015fen d\u00f6nd\u00fcr\u00fcr. Bu yeni bile\u015fen, orijinal bile\u015fenin i\u015flevselli\u011fini geni\u015fletir veya de\u011fi\u015ftirir. \u00d6nemli olan, HOC&#8217;lar\u0131n orijinal bile\u015feni do\u011frudan de\u011fi\u015ftirmemesi, aksine onu bir kapsay\u0131c\u0131 (wrapper) i\u00e7inde sarmas\u0131 ve yeni bir bile\u015fen \u00fcretmesidir. Bu, yan etkileri \u00f6nleyen ve bile\u015fenlerin saf kalmas\u0131n\u0131 sa\u011flayan &#8220;bile\u015fim&#8221; (composition) ilkesine uygun bir yakla\u015f\u0131md\u0131r.<\/p>\n<h3>Neden HOC&#8217;lara \u0130htiya\u00e7 Duyar\u0131z?<\/h3>\n<p>React uygulamalar\u0131 b\u00fcy\u00fcd\u00fck\u00e7e, farkl\u0131 bile\u015fenler aras\u0131nda ayn\u0131 mant\u0131\u011f\u0131 veya i\u015flevselli\u011fi tekrar tekrar yazma ihtiyac\u0131 ortaya \u00e7\u0131kabilir. Bu durum, &#8220;Kendini Tekrar Etme&#8221; (Don&#8217;t Repeat Yourself &#8211; DRY) ilkesine ayk\u0131r\u0131d\u0131r ve kodun s\u00fcrd\u00fcr\u00fclebilirli\u011fini, test edilebilirli\u011fini ve okunabilirli\u011fini olumsuz etkiler. HOC&#8217;lar, bu t\u00fcr \u00e7apraz kesen ilgileri (cross-cutting concerns) \u00e7\u00f6zmek i\u00e7in g\u00fc\u00e7l\u00fc bir mekanizma sunar.<\/p>\n<h4>Mant\u0131k Payla\u015f\u0131m\u0131 (Logic Reusability)<\/h4>\n<p>En temel nedenlerden biri, bile\u015fenler aras\u0131nda durum mant\u0131\u011f\u0131n\u0131, ya\u015fam d\u00f6ng\u00fcs\u00fc metotlar\u0131n\u0131 veya di\u011fer davran\u0131\u015flar\u0131 payla\u015fmakt\u0131r. \u00d6rne\u011fin, farkl\u0131 bile\u015fenlerin ayn\u0131 veri \u00e7ekme mant\u0131\u011f\u0131na, kimlik do\u011frulama kontrol\u00fcne veya kullan\u0131c\u0131 giri\u015fini i\u015fleme \u015fekline ihtiyac\u0131 olabilir. HOC&#8217;lar, bu ortak mant\u0131\u011f\u0131 bir kez yaz\u0131p birden fazla bile\u015fene uygulamam\u0131z\u0131 sa\u011flar.<\/p>\n<h4>\u00d6zellik Ekleme ve Manip\u00fclasyonu (Prop Injection and Manipulation)<\/h4>\n<p>HOC&#8217;lar, sar\u0131lm\u0131\u015f bile\u015fene yeni \u00f6zellikler (props) ekleyebilir, mevcut \u00f6zellikleri de\u011fi\u015ftirebilir veya baz\u0131lar\u0131n\u0131 gizleyebilir. Bu, bile\u015fenlerin belirli bir veri kayna\u011f\u0131na veya global bir duruma eri\u015fmesini sa\u011flamak i\u00e7in kullan\u0131\u015fl\u0131d\u0131r. \u00d6rne\u011fin, bir HOC, bir Redux store&#8217;dan veri \u00e7ekip bunu bir bile\u015fene <code>data<\/code> prop&#8217;u olarak iletebilir.<\/p>\n<h4>Soyutlama ve Kaps\u00fclleme (Abstraction and Encapsulation)<\/h4>\n<p>HOC&#8217;lar, belirli bir i\u015flevselli\u011fin ayr\u0131 bir yerde kaps\u00fcllenmesini sa\u011flar. Bu, bile\u015fenin kendisinin bu i\u015flevselli\u011fin detaylar\u0131n\u0131 bilmesine gerek kalmadan kullan\u0131labilece\u011fi anlam\u0131na gelir. Bu sayede, bile\u015fenler daha odaklanm\u0131\u015f ve daha az karma\u015f\u0131k hale gelir.<\/p>\n<h4>Yan Etkisiz \u0130\u015flemler (Side-Effect Management)<\/h4>\n<p>HOC&#8217;lar, bile\u015fenlerin render d\u00f6ng\u00fcs\u00fcn\u00fc veya ya\u015fam d\u00f6ng\u00fcs\u00fcn\u00fc etkileyen yan etkileri (\u00f6rne\u011fin, abonelikler, zamanlay\u0131c\u0131lar) y\u00f6netmek i\u00e7in kullan\u0131labilir. Bu, bile\u015fenin kendisinin bu yan etkilerle u\u011fra\u015fmak zorunda kalmamas\u0131n\u0131 sa\u011flar.<\/p>\n<h4>\u00d6rnek Kullan\u0131m Senaryolar\u0131:<\/h4>\n<p>*   <strong>Veri \u00c7ekme:<\/strong> <code>withData(dataSourceUrl)(MyComponent)<\/code> ile bir bile\u015fene d\u0131\u015far\u0131dan veri enjekte etmek.<br \/>\n*   <strong>Kimlik Do\u011frulama\/Yetkilendirme:<\/strong> <code>withAuth(MyComponent)<\/code> ile yaln\u0131zca yetkili kullan\u0131c\u0131lar\u0131n g\u00f6rebilece\u011fi bile\u015fenler olu\u015fturmak.<br \/>\n*   <strong>Stil Y\u00f6netimi:<\/strong> <code>withStyles(MyComponent)<\/code> ile bile\u015fenlere dinamik stil \u00f6zellikleri eklemek (eski CSS-in-JS k\u00fct\u00fcphanelerinde yayg\u0131nd\u0131).<br \/>\n*   <strong>Form Y\u00f6netimi:<\/strong> <code>withFormik(MyComponent)<\/code> gibi k\u00fct\u00fcphanelerle form durumunu ve validasyonunu y\u00f6netmek.<br \/>\n*   <strong>Performans Optimizasyonu:<\/strong> <code>withMemo(MyComponent)<\/code> gibi HOC&#8217;lar ile gereksiz yeniden render&#8217;lar\u0131 engellemek.<\/p>\n<h3>\u0130lk HOC&#8217;umuzu Olu\u015fturma: <code>withLogger<\/code><\/h3>\n<p>\u015eimdi basit bir HOC \u00f6rne\u011fi ile konuyu daha iyi anlayal\u0131m. Amac\u0131m\u0131z, herhangi bir React bile\u015feninin ne zaman mount edildi\u011fini (olu\u015fturuldu\u011funu) ve ne zaman update edildi\u011fini (g\u00fcncellendi\u011fini) konsola yazd\u0131ran bir HOC olu\u015fturmak.<\/p>\n<p>\u00d6nce, sar\u0131lacak basit bir bile\u015fen tan\u0131mlayal\u0131m:<\/p>\n<pre><code class=\"language-javascript\">\/\/ MyComponent.js\nimport React from 'react';\n\nconst MyComponent = ({ message }) => {\n  return (\n    <div>\n      <h3>MyComponent<\/h3>\n      <p>{message}<\/p>\n    <\/div>\n  );\n};\n\nexport default MyComponent;<\/code><\/pre>\n<p>\u015eimdi <code>withLogger<\/code> HOC&#8217;umuzu olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-javascript\">\/\/ withLogger.js\nimport React from 'react';\n\nconst withLogger = (WrappedComponent) => {\n  \/\/ HOC'un displayName'ini ayarlamak, hata ay\u0131klama i\u00e7in \u00f6nemlidir.\n  \/\/ Bu, React DevTools'ta daha anlaml\u0131 bir isim g\u00f6rmemizi sa\u011flar.\n  const componentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n  class WithLogger extends React.Component {\n    componentDidMount() {\n      console.log(<code>${componentName}: Bile\u015fen mount edildi.<\/code>);\n    }\n\n    componentDidUpdate(prevProps, prevState) {\n      console.log(<code>${componentName}: Bile\u015fen g\u00fcncellendi.<\/code>);\n      \/\/ Opsiyonel: Props de\u011fi\u015fikliklerini loglamak\n      \/\/ console.log('\u00d6nceki Props:', prevProps);\n      \/\/ console.log('\u015eimdiki Props:', this.props);\n    }\n\n    componentWillUnmount() {\n      console.log(<code>${componentName}: Bile\u015fen unmount edildi.<\/code>);\n    }\n\n    render() {\n      \/\/ Orijinal bile\u015fenin t\u00fcm \u00f6zelliklerini (props) ona iletiyoruz.\n      return <WrappedComponent {...this.props} \/>;\n    }\n  }\n\n  \/\/ HOC'un displayName'ini ayarlamak\n  WithLogger.displayName = <code>WithLogger(${componentName})<\/code>;\n\n  return WithLogger;\n};\n\nexport default withLogger;<\/code><\/pre>\n<p>Ve \u015fimdi <code>MyComponent<\/code>&#8216;i <code>withLogger<\/code> ile sarmalayal\u0131m ve kullanal\u0131m:<\/p>\n<pre><code class=\"language-javascript\">\/\/ App.js\nimport React, { useState } from 'react';\nimport MyComponent from '.\/MyComponent';\nimport withLogger from '.\/withLogger';\n\n\/\/ MyComponent'i withLogger HOC'u ile sarmala\nconst MyLoggedComponent = withLogger(MyComponent);\n\nfunction App() {\n  const [count, setCount] = useState(0);\n\n  return (\n    <div>\n      <h2>HOC \u00d6rne\u011fi: withLogger<\/h2>\n      <MyLoggedComponent message={<code>Sayac\u0131n de\u011feri: ${count}<\/code>} \/>\n      <button onClick={() => setCount(count + 1)}>Sayac\u0131 Art\u0131r<\/button>\n    <\/div>\n  );\n}\n\nexport default App;<\/code><\/pre>\n<p>Bu \u00f6rnekte, <code>MyLoggedComponent<\/code> art\u0131k <code>MyComponent<\/code>&#8216;in t\u00fcm \u00f6zelliklerine sahip olmas\u0131n\u0131n yan\u0131 s\u0131ra, <code>withLogger<\/code> HOC&#8217;unun ekledi\u011fi ya\u015fam d\u00f6ng\u00fcs\u00fc loglama davran\u0131\u015f\u0131n\u0131 da i\u00e7erir. <code>App<\/code> bile\u015fenindeki <code>count<\/code> durumu de\u011fi\u015fti\u011finde, <code>MyLoggedComponent<\/code> yeniden render edilecek ve konsola &#8220;Bile\u015fen g\u00fcncellendi.&#8221; mesaj\u0131 yaz\u0131lacakt\u0131r.<\/p>\n<h3>Daha Geli\u015fmi\u015f Bir HOC: <code>withData<\/code><\/h3>\n<p>\u015eimdi, bir API&#8217;den veri \u00e7eken ve bu veriyi sar\u0131lm\u0131\u015f bile\u015fene <code>data<\/code> prop&#8217;u olarak ileten bir HOC olu\u015ftural\u0131m. Bu HOC, ayr\u0131ca bir y\u00fckleme durumu (<code>isLoading<\/code>) ve hata durumu (<code>error<\/code>) da y\u00f6netecek.<\/p>\n<pre><code class=\"language-javascript\">\/\/ withData.js\nimport React, { useState, useEffect } from 'react';\n\nconst withData = (url) => (WrappedComponent) => {\n  const componentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n  const WithData = (props) => {\n    const [data, setData] = useState(null);\n    const [isLoading, setIsLoading] = useState(true);\n    const [error, setError] = useState(null);\n\n    useEffect(() => {\n      const fetchData = async () => {\n        try {\n          const response = await fetch(url);\n          if (!response.ok) {\n            throw new Error(<code>HTTP hatas\u0131! Durum: ${response.status}<\/code>);\n          }\n          const result = await response.json();\n          setData(result);\n        } catch (err) {\n          setError(err);\n        } finally {\n          setIsLoading(false);\n        }\n      };\n\n      fetchData();\n    }, [url]); \/\/ URL de\u011fi\u015fti\u011finde veriyi tekrar \u00e7ek\n\n    if (isLoading) {\n      return <div>Veriler y\u00fckleniyor...<\/div>;\n    }\n\n    if (error) {\n      return <div>Hata: {error.message}<\/div>;\n    }\n\n    \/\/ Y\u00fcklenen veriyi ve di\u011fer t\u00fcm orijinal props'lar\u0131 WrappedComponent'e iletiyoruz.\n    return <WrappedComponent data={data} isLoading={isLoading} error={error} {...props} \/>;\n  };\n\n  WithData.displayName = <code>WithData(${componentName})<\/code>;\n  return WithData;\n};\n\nexport default withData;<\/code><\/pre>\n<p>Bu <code>withData<\/code> HOC&#8217;u, iki seviyeli bir fonksiyon olarak tan\u0131mlanm\u0131\u015ft\u0131r. \u0130lk seviye, HOC&#8217;a yap\u0131land\u0131rma arg\u00fcmanlar\u0131n\u0131 (bu durumda <code>url<\/code>) alman\u0131z\u0131 sa\u011flar. \u0130kinci seviye ise sar\u0131lacak bile\u015feni (<code>WrappedComponent<\/code>) al\u0131r.<\/p>\n<p>\u015eimdi bu HOC&#8217;u kullanal\u0131m. Bir kullan\u0131c\u0131 listesi g\u00f6r\u00fcnt\u00fcleyen basit bir bile\u015fen olu\u015ftural\u0131m:<\/p>\n<pre><code class=\"language-javascript\">\/\/ UserList.js\nimport React from 'react';\n\nconst UserList = ({ data, title }) => {\n  if (!data || data.length === 0) {\n    return <p>Kullan\u0131c\u0131 bulunamad\u0131.<\/p>;\n  }\n\n  return (\n    <div>\n      <h3>{title}<\/h3>\n      <ul>\n        {data.map(user => (\n          <li key={user.id}>{user.name} ({user.email})<\/li>\n        ))}\n      <\/ul>\n    <\/div>\n  );\n};\n\nexport default UserList;<\/code><\/pre>\n<p>Ve <code>App.js<\/code> i\u00e7inde <code>withData<\/code> ile sarmalayal\u0131m:<\/p>\n<pre><code class=\"language-javascript\">\/\/ App.js\nimport React from 'react';\nimport UserList from '.\/UserList';\nimport withData from '.\/withData';\n\n\/\/ withData HOC'unu kullanarak UserList bile\u015fenine kullan\u0131c\u0131 verilerini enjekte et\nconst UsersWithData = withData('https:\/\/jsonplaceholder.typicode.com\/users')(UserList);\n\nfunction App() {\n  return (\n    <div>\n      <h2>HOC \u00d6rne\u011fi: withData<\/h2>\n      <UsersWithData title=\"Kullan\u0131c\u0131 Listesi\" \/>\n    <\/div>\n  );\n}\n\nexport default App;<\/code><\/pre>\n<p>Bu \u00f6rnekte, <code>UsersWithData<\/code> bile\u015feni, <code>UserList<\/code> bile\u015feninin t\u00fcm \u00f6zelliklerine sahip olmas\u0131n\u0131n yan\u0131 s\u0131ra, <code>https:\/\/jsonplaceholder.typicode.com\/users<\/code> adresinden \u00e7ekilen kullan\u0131c\u0131 verilerini <code>data<\/code> prop&#8217;u olarak al\u0131r. Y\u00fckleme ve hata durumlar\u0131 da <code>withData<\/code> HOC&#8217;u taraf\u0131ndan y\u00f6netilir.<\/p>\n<h3>HOC Kullan\u0131m\u0131nda Kurallar ve En \u0130yi Uygulamalar<\/h3>\n<p>HOC&#8217;lar g\u00fc\u00e7l\u00fc olsa da, do\u011fru kullan\u0131lmad\u0131\u011f\u0131nda baz\u0131 sorunlara yol a\u00e7abilirler. \u0130\u015fte HOC kullan\u0131rken dikkat edilmesi gereken baz\u0131 kurallar ve en iyi uygulamalar:<\/p>\n<h4>1. Sar\u0131lm\u0131\u015f Bile\u015fenin \u00d6zelliklerini Tamamen \u0130letin<\/h4>\n<p>HOC&#8217;unuz, sar\u0131lm\u0131\u015f bile\u015fene iletilen t\u00fcm orijinal \u00f6zellikleri (props) ve hatta referanslar\u0131 (<code>ref<\/code>) aynen aktarmal\u0131d\u0131r. Aksi takdirde, sar\u0131lm\u0131\u015f bile\u015fen beklenen \u015fekilde \u00e7al\u0131\u015fmayabilir veya belirli \u00f6zelliklere eri\u015femeyebilir.<\/p>\n<pre><code class=\"language-javascript\">\/\/ Do\u011fru kullan\u0131m\nrender() {\n  \/\/ ... HOC'un kendi mant\u0131\u011f\u0131 ...\n  return <WrappedComponent {...this.props} \/>; \/\/ T\u00fcm props'lar iletiliyor\n}<\/code><\/pre>\n<h4>2. <code>displayName<\/code> Ayarlay\u0131n<\/h4>\n<p>Hata ay\u0131klama s\u0131ras\u0131nda, React DevTools&#8217;ta HOC taraf\u0131ndan olu\u015fturulan bile\u015fenlerin anlaml\u0131 isimlere sahip olmas\u0131 \u00f6nemlidir. Bu, bile\u015fen hiyerar\u015fisini daha kolay anlaman\u0131za yard\u0131mc\u0131 olur.<\/p>\n<pre><code class=\"language-javascript\">const higherOrderComponent = (WrappedComponent) => {\n  const componentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n  class HOC extends React.Component { \/<em> ... <\/em>\/ }\n  HOC.displayName = <code>withSomething(${componentName})<\/code>;\n  return HOC;\n};<\/code><\/pre>\n<h4>3. Statik Metotlar\u0131 Kopyalay\u0131n<\/h4>\n<p>Sar\u0131lm\u0131\u015f bile\u015fenin statik metotlar\u0131 (\u00f6rne\u011fin, <code>MyComponent.staticMethod = () => {}<\/code>) varsa, bunlar HOC taraf\u0131ndan olu\u015fturulan yeni bile\u015fende otomatik olarak mevcut olmaz. Bu metotlar\u0131 kopyalamak i\u00e7in <code>hoist-non-react-statics<\/code> gibi bir k\u00fct\u00fcphane kullanabilirsiniz.<\/p>\n<pre><code class=\"language-javascript\">import hoistNonReactStatics from 'hoist-non-react-statics';\n\nconst withSomething = (WrappedComponent) => {\n  class HOC extends React.Component { \/<em> ... <\/em>\/ }\n  hoistNonReactStatics(HOC, WrappedComponent); \/\/ Statik metotlar\u0131 kopyala\n  return HOC;\n};<\/code><\/pre>\n<h4>4. Referanslar\u0131 (Refs) \u0130letin: <code>React.forwardRef<\/code><\/h4>\n<p>E\u011fer bir HOC taraf\u0131ndan sar\u0131lm\u0131\u015f bile\u015fene d\u0131\u015far\u0131dan bir <code>ref<\/code> iletilmesi gerekiyorsa (\u00f6rne\u011fin, bir DOM elementine do\u011frudan eri\u015fmek i\u00e7in), HOC&#8217;un bu <code>ref<\/code>&#8216;i i\u00e7indeki sar\u0131lm\u0131\u015f bile\u015fene do\u011fru \u015fekilde iletmesi gerekir. React v16.3&#8217;ten itibaren <code>React.forwardRef<\/code> bu ama\u00e7la kullan\u0131l\u0131r.<\/p>\n<pre><code class=\"language-javascript\">import React from 'react';\n\nconst withRefForwarding = (WrappedComponent) => {\n  const componentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n\n  const HOC = React.forwardRef((props, ref) => {\n    return <WrappedComponent ref={ref} {...props} \/>;\n  });\n\n  HOC.displayName = <code>WithRefForwarding(${componentName})<\/code>;\n  return HOC;\n};\n\n\/\/ Kullan\u0131m \u00f6rne\u011fi\nconst MyInput = React.forwardRef((props, ref) => <input ref={ref} {...props} \/>);\nconst EnhancedInput = withRefForwarding(MyInput);\n\nfunction App() {\n  const inputRef = React.useRef();\n  const handleClick = () => {\n    inputRef.current.focus();\n  };\n  return (\n    <div>\n      <EnhancedInput ref={inputRef} placeholder=\"Odaklanmak i\u00e7in t\u0131kla\" \/>\n      <button onClick={handleClick}>Odaklan<\/button>\n    <\/div>\n  );\n}<\/code><\/pre>\n<p>Bu \u00f6rnekte, <code>withRefForwarding<\/code> HOC&#8217;u, <code>React.forwardRef<\/code> kullanarak d\u0131\u015far\u0131dan gelen <code>ref<\/code>&#8216;i <code>WrappedComponent<\/code>&#8216;e iletir.<\/p>\n<h4>5. HOC&#8217;u Render Metodu \u0130\u00e7inde Olu\u015fturmay\u0131n<\/h4>\n<p>Bir HOC&#8217;u bir bile\u015fenin <code>render<\/code> metodu i\u00e7inde tan\u0131mlamak veya kullanmak ciddi performans sorunlar\u0131na yol a\u00e7ar. Her render&#8217;da yeni bir bile\u015fen tipi olu\u015fturulur, bu da React&#8217;in bile\u015fen a\u011fac\u0131n\u0131 verimli bir \u015fekilde kar\u015f\u0131la\u015ft\u0131rmas\u0131n\u0131 (reconciliation) engeller ve t\u00fcm alt a\u011fac\u0131n yeniden mount edilmesine neden olur. HOC&#8217;lar\u0131 her zaman bile\u015fenin d\u0131\u015f\u0131nda, mod\u00fcl seviyesinde tan\u0131mlay\u0131n.<\/p>\n<pre><code class=\"language-javascript\">\/\/ Yanl\u0131\u015f kullan\u0131m!\nclass MyComponent extends React.Component {\n  render() {\n    const EnhancedComponent = withSomething(AnotherComponent); \/\/ Her render'da yeni bile\u015fen\n    return <EnhancedComponent \/>;\n  }\n}\n\n\/\/ Do\u011fru kullan\u0131m\nconst EnhancedComponent = withSomething(AnotherComponent); \/\/ Mod\u00fcl seviyesinde bir kez tan\u0131mla\nclass MyComponent extends React.Component {\n  render() {\n    return <EnhancedComponent \/>;\n  }\n}<\/code><\/pre>\n<h4>6. HOC&#8217;lar\u0131 Zincirleme (Composition)<\/h4>\n<p>Birden fazla HOC&#8217;u bir bile\u015fene uygulamak m\u00fcmk\u00fcnd\u00fcr. Fonksiyonel bir yakla\u015f\u0131mla, bunlar\u0131 i\u00e7 i\u00e7e ge\u00e7irebilirsiniz:<\/p>\n<pre><code class=\"language-javascript\">const EnhancedComponent = withAuth(withData('\/api\/users')(withLogger(MyComponent)));<\/code><\/pre>\n<p>Veya okunabilirli\u011fi art\u0131rmak i\u00e7in bir yard\u0131mc\u0131 fonksiyon kullanabilirsiniz:<\/p>\n<pre><code class=\"language-javascript\">import { compose } from 'redux'; \/\/ veya kendi compose fonksiyonunuz\n\nconst enhance = compose(\n  withAuth,\n  withData('\/api\/users'),\n  withLogger\n);\n\nconst EnhancedComponent = enhance(MyComponent);<\/code><\/pre>\n<h3>HOC&#8217;lar\u0131n Dezavantajlar\u0131 ve Alternatifleri<\/h3>\n<p>HOC&#8217;lar g\u00fc\u00e7l\u00fc bir desen olsa da, baz\u0131 dezavantajlar\u0131 vard\u0131r ve bu nedenle React Hooks gibi modern alternatifler ortaya \u00e7\u0131km\u0131\u015ft\u0131r.<\/p>\n<h4>Dezavantajlar\u0131:<\/h4>\n<p>1.  <strong>Prop \u00c7ak\u0131\u015fmalar\u0131 (Prop Collisions):<\/strong> HOC&#8217;lar, sar\u0131lm\u0131\u015f bile\u015fene yeni \u00f6zellikler eklerken, bu \u00f6zelliklerin adlar\u0131 mevcut \u00f6zelliklerle \u00e7ak\u0131\u015fabilir. Bu, beklenmeyen davran\u0131\u015flara veya hatalara yol a\u00e7abilir. \u00c7\u00f6z\u00fcm olarak, HOC&#8217;lar genellikle ekledikleri prop&#8217;lara benzersiz bir \u00f6nek ekler (\u00f6rne\u011fin, <code>data-hoc-value<\/code>).<br \/>\n2.  <strong>Soyutlama Katman\u0131 (Abstraction Layer):<\/strong> HOC&#8217;lar, bile\u015fen a\u011fac\u0131na bir soyutlama katman\u0131 ekler. Bu, \u00f6zellikle birden fazla HOC zincirlendi\u011finde, bir bile\u015fenin nihai \u00f6zelliklerinin nereden geldi\u011fini anlamay\u0131 zorla\u015ft\u0131rabilir (&#8220;Wrapper Hell&#8221; veya &#8220;Prop Source Ambiguity&#8221;). React DevTools&#8217;ta HOC&#8217;lar\u0131n i\u00e7 i\u00e7e ge\u00e7mi\u015f yap\u0131s\u0131n\u0131 g\u00f6rmek, bazen karma\u015f\u0131k bir bile\u015fen a\u011fac\u0131na yol a\u00e7ar.<br \/>\n3.  <strong><code>ref<\/code> ve Statik Metot Sorunlar\u0131:<\/strong> Yukar\u0131da bahsedildi\u011fi gibi, <code>ref<\/code>&#8216;lerin ve statik metotlar\u0131n do\u011fru \u015fekilde iletilmesi ek \u00e7aba gerektirir (<code>React.forwardRef<\/code>, <code>hoist-non-react-statics<\/code>). Bu, geli\u015ftirici deneyimini biraz karma\u015f\u0131kla\u015ft\u0131r\u0131r.<br \/>\n4.  <strong>Test Edilebilirlik:<\/strong> HOC&#8217;larla sar\u0131lm\u0131\u015f bile\u015fenleri test etmek, HOC&#8217;un mant\u0131\u011f\u0131n\u0131 da hesaba katmay\u0131 gerektirebilir. Bazen HOC&#8217;u test etmek i\u00e7in sar\u0131lm\u0131\u015f bile\u015fenin bir mock&#8217;unu olu\u015fturmak gerekir.<br \/>\n5.  <strong>Render Metodu \u0130\u00e7inde Kullan\u0131m Hatas\u0131:<\/strong> HOC&#8217;lar\u0131 yanl\u0131\u015fl\u0131kla <code>render<\/code> metodu i\u00e7inde kullanma e\u011filimi, performans sorunlar\u0131na yol a\u00e7abilen yayg\u0131n bir hatad\u0131r.<\/p>\n<h4>Alternatifler:<\/h4>\n<p>1.  <strong>React Hooks:<\/strong> React v16.8 ile tan\u0131t\u0131lan Hooks, fonksiyonel bile\u015fenlerde durum ve ya\u015fam d\u00f6ng\u00fcs\u00fc \u00f6zelliklerini kullanman\u0131n modern ve tercih edilen yoludur. Hooks, HOC&#8217;lar\u0131n \u00e7\u00f6zd\u00fc\u011f\u00fc bir\u00e7ok mant\u0131k payla\u015f\u0131m\u0131 sorununu daha do\u011frudan ve daha az soyutlama ile \u00e7\u00f6zer. <code>useState<\/code>, <code>useEffect<\/code>, <code>useContext<\/code> gibi yerle\u015fik Hooks&#8217;lar ve \u00f6zel Hooks&#8217;lar olu\u015fturma yetene\u011fi sayesinde, HOC&#8217;lar\u0131n getirdi\u011fi bir\u00e7ok karma\u015f\u0131kl\u0131k ortadan kalkar. Hooks, &#8220;Wrapper Hell&#8221; sorununu b\u00fcy\u00fck \u00f6l\u00e7\u00fcde azalt\u0131r ve bile\u015fenlerin daha okunabilir ve test edilebilir olmas\u0131n\u0131 sa\u011flar.<br \/>\n    *   <strong>Ne zaman Hooks tercih edilmeli?<\/strong> Yeni projelerde veya mevcut projelerde yeni mant\u0131k eklerken genellikle Hooks tercih edilir. Durum y\u00f6netimi, yan etkiler, veri \u00e7ekme gibi bir\u00e7ok senaryoda Hooks daha ergonomik bir \u00e7\u00f6z\u00fcm sunar.<br \/>\n2.  <strong>Render Props:<\/strong> Render Props deseni, bir bile\u015fenin render edece\u011fi \u015feyi bir prop olarak bir fonksiyona devretti\u011fi bir tekniktir. Bu da mant\u0131k payla\u015f\u0131m\u0131 i\u00e7in bir y\u00f6ntemdir. \u00d6rne\u011fin, <code>react-router<\/code>&#8216;\u0131n eski versiyonlar\u0131nda veya <code>react-stripe-elements<\/code> gibi k\u00fct\u00fcphanelerde <code>render<\/code> prop&#8217;u kullan\u0131lm\u0131\u015ft\u0131r.<\/p>\n<pre><code class=\"language-javascript\"><DataProvider render={data => (\n      <MyComponent data={data} \/>\n    )}\/><\/code><\/pre>\n<p>    Render Props, HOC&#8217;lara g\u00f6re daha az soyutlama katman\u0131 ekler ve prop \u00e7ak\u0131\u015fmas\u0131 sorununu genellikle \u00f6nler. Ancak, i\u00e7 i\u00e7e ge\u00e7mi\u015f render prop&#8217;lar\u0131 da &#8220;Callback Hell&#8221; benzeri bir yap\u0131ya yol a\u00e7abilir. Hooks, Render Props&#8217;un da bir\u00e7ok kullan\u0131m senaryosunu daha temiz bir \u015fekilde ele al\u0131r.<\/p>\n<h3>HOC&#8217;lar ve Hooks: Ne Zaman Hangisi?<\/h3>\n<p>React ekosisteminde Hooks&#8217;un y\u00fckseli\u015fi, HOC&#8217;lar\u0131n eski moda oldu\u011fu anlam\u0131na gelmez, ancak kullan\u0131m alanlar\u0131n\u0131 daraltm\u0131\u015ft\u0131r.<\/p>\n<p>*   <strong>Hooks&#8217;u Ne Zaman Kullanmal\u0131?<\/strong><br \/>\n    *   Yeni projelerde ve yeni \u00f6zellikler geli\u015ftirirken.<br \/>\n    *   Fonksiyonel bile\u015fenlerde durum, yan etkiler ve di\u011fer React \u00f6zelliklerini kullanmak istedi\u011finizde.<br \/>\n    *   Bile\u015fenler aras\u0131 mant\u0131k payla\u015f\u0131m\u0131 yaparken, <code>useContext<\/code> veya \u00f6zel Hooks&#8217;lar arac\u0131l\u0131\u011f\u0131yla.<br \/>\n    *   Daha az i\u00e7 i\u00e7e ge\u00e7mi\u015f yap\u0131 ve daha d\u00fcz bir bile\u015fen a\u011fac\u0131 istedi\u011finizde.<\/p>\n<p>*   <strong>HOC&#8217;u Ne Zaman Kullanmal\u0131?<\/strong><br \/>\n    *   <strong>Mevcut Kod Tabanlar\u0131:<\/strong> E\u011fer projeniz zaten HOC&#8217;lar\u0131 yo\u011fun bir \u015fekilde kullan\u0131yorsa, bunlar\u0131 Hooks&#8217;a d\u00f6n\u00fc\u015ft\u00fcrmek her zaman \u00f6ncelikli veya maliyet etkin olmayabilir. Mevcut HOC&#8217;lar\u0131 anlamak ve s\u00fcrd\u00fcrmek \u00f6nemlidir.<br \/>\n    *   <strong>K\u00fct\u00fcphane Geli\u015ftirme:<\/strong> Baz\u0131 durumlarda, bir k\u00fct\u00fcphane geli\u015ftiricisi olarak, kullan\u0131c\u0131lar\u0131n bile\u015fenlerini sarmalayarak belirli bir i\u015flevsellik eklemek isteyebilirsiniz. \u00d6rne\u011fin, Redux&#8217;un <code>connect<\/code> fonksiyonu veya eski <code>react-router<\/code>&#8216;\u0131n <code>withRouter<\/code>&#8216;\u0131 HOC \u00f6rnekleridir. Bu t\u00fcr k\u00fct\u00fcphaneler, kullan\u0131c\u0131lar\u0131n kendi bile\u015fenlerini HOC&#8217;larla kolayca geni\u015fletmelerine olanak tan\u0131r.<br \/>\n    *   <strong>Render \u00c7\u0131kt\u0131s\u0131n\u0131 De\u011fi\u015ftirmek:<\/strong> HOC&#8217;lar, sar\u0131lm\u0131\u015f bile\u015fenin render \u00e7\u0131kt\u0131s\u0131n\u0131 do\u011frudan de\u011fi\u015ftirebilir (\u00f6rne\u011fin, ko\u015fullu render veya bile\u015feni ba\u015fka bir \u015feyle sarmalama). Hooks daha \u00e7ok davran\u0131\u015f ve mant\u0131k eklemeye odaklan\u0131rken, HOC&#8217;lar bile\u015fenin yap\u0131s\u0131n\u0131 daha fazla etkileyebilir.<br \/>\n    *   <strong>Class Component&#8217;lerle Uyum:<\/strong> HOC&#8217;lar hem fonksiyonel hem de s\u0131n\u0131f bile\u015fenleriyle \u00e7al\u0131\u015fabilirken, Hooks yaln\u0131zca fonksiyonel bile\u015fenlerle \u00e7al\u0131\u015f\u0131r. E\u011fer hala b\u00fcy\u00fck bir s\u0131n\u0131f bile\u015feni taban\u0131n\u0131z varsa ve bunu Hooks&#8217;a d\u00f6n\u00fc\u015ft\u00fcrmek istemiyorsan\u0131z, HOC&#8217;lar bir \u00e7\u00f6z\u00fcm olabilir.<\/p>\n<p>\u00d6zetle, Hooks \u00e7o\u011fu durumda HOC&#8217;lara g\u00f6re daha modern, okunabilir ve daha az karma\u015f\u0131k bir alternatiftir. Ancak, HOC&#8217;lar React&#8217;in evriminde \u00f6nemli bir rol oynam\u0131\u015f ve hala belirli senaryolarda ge\u00e7erli bir desendir. Bir React geli\u015ftiricisi olarak her iki deseni de anlamak, ara\u00e7 kutunuzu geni\u015fletir ve farkl\u0131 durumlar i\u00e7in en uygun \u00e7\u00f6z\u00fcm\u00fc se\u00e7menize olanak tan\u0131r.<\/p>\n<h3>Sonu\u00e7<\/h3>\n<p>Y\u00fcksek Mertebeden Bile\u015fenler (HOCs), React&#8217;te bile\u015fenler aras\u0131 mant\u0131k payla\u015f\u0131m\u0131 ve yeniden kullan\u0131labilirli\u011fi sa\u011flamak i\u00e7in g\u00fc\u00e7l\u00fc bir desendir. Bir bile\u015feni girdi olarak al\u0131p geli\u015ftirilmi\u015f \u00f6zelliklere sahip yeni bir bile\u015fen d\u00f6nd\u00fcrerek \u00e7al\u0131\u015f\u0131rlar. Veri \u00e7ekme, kimlik do\u011frulama, stil y\u00f6netimi gibi bir\u00e7ok \u00e7apraz kesen ilgiyi \u00e7\u00f6zmek i\u00e7in etkili bir yol sunmu\u015flard\u0131r.<\/p>\n<p>HOC&#8217;lar, React&#8217;in ilk d\u00f6nemlerinde ve b\u00fcy\u00fck k\u00fct\u00fcphanelerde yayg\u0131n olarak kullan\u0131lm\u0131\u015f, kod tekrar\u0131n\u0131 azaltarak ve soyutlama sa\u011flayarak geli\u015ftiricilere b\u00fcy\u00fck kolayl\u0131klar sa\u011flam\u0131\u015ft\u0131r. Ancak, prop \u00e7ak\u0131\u015fmalar\u0131, <code>ref<\/code> ve statik metot y\u00f6netimi gibi dezavantajlar\u0131 ve &#8220;Wrapper Hell&#8221; gibi sorunlar\u0131 da beraberinde getirmi\u015ftir.<\/p>\n<p>React Hooks&#8217;un tan\u0131t\u0131lmas\u0131yla birlikte, HOC&#8217;lar\u0131n bir\u00e7ok kullan\u0131m senaryosu i\u00e7in daha temiz ve daha do\u011frudan bir alternatif ortaya \u00e7\u0131km\u0131\u015ft\u0131r. Hooks, fonksiyonel bile\u015fenlerde durum ve yan etkileri y\u00f6netmeyi basitle\u015ftirerek, \u00e7o\u011fu yeni geli\u015ftirme i\u00e7in tercih edilen y\u00f6ntem haline gelmi\u015ftir.<\/p>\n<p>Yine de, HOC&#8217;lar tamamen ortadan kalkmam\u0131\u015ft\u0131r. Mevcut kod tabanlar\u0131nda, belirli k\u00fct\u00fcphane entegrasyonlar\u0131nda ve baz\u0131 \u00f6zel senaryolarda hala ge\u00e7erli ve de\u011ferli bir desendir. Her React geli\u015ftiricisinin, hem HOC&#8217;lar\u0131n nas\u0131l \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131 hem de Hooks&#8217;un avantajlar\u0131n\u0131 anlamas\u0131, daha bilin\u00e7li mimari kararlar almas\u0131na ve farkl\u0131 projelerdeki ihtiya\u00e7lara uygun \u00e7\u00f6z\u00fcmler \u00fcretmesine yard\u0131mc\u0131 olacakt\u0131r. React&#8217;in s\u00fcrekli geli\u015fen ekosisteminde, farkl\u0131 desenleri anlamak, sa\u011flam ve s\u00fcrd\u00fcr\u00fclebilir uygulamalar in\u015fa etmenin anahtar\u0131d\u0131r.<\/body><\/p>\n","protected":false},"excerpt":{"rendered":"React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f\nReact ekosistemi, bile\u015fenler aras\u0131 mant\u0131k payla\u015f\u0131","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[128],"tags":[],"class_list":{"0":"post-32972","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-react","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>React&#039;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React&#039;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f\" \/>\n<meta property=\"og:description\" content=\"React&#039;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f React ekosistemi, bile\u015fenler aras\u0131 mant\u0131k payla\u015f\u0131\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-27T22:40:52+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f\",\"datePublished\":\"2025-10-27T22:40:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\"},\"wordCount\":2529,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"React\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#respond\"]}],\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\",\"name\":\"React'in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2025-10-27T22:40:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"React'in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/","og_locale":"tr_TR","og_type":"article","og_title":"React'in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f","og_description":"React'in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f React ekosistemi, bile\u015fenler aras\u0131 mant\u0131k payla\u015f\u0131","og_url":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2025-10-27T22:40:52+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"15 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f","datePublished":"2025-10-27T22:40:52+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/"},"wordCount":2529,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["React"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#respond"]}],"copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/","url":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/","name":"React'in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components - HOCs) H\u0131zl\u0131 Bir Giri\u015f - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2025-10-27T22:40:52+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/reactin-yuksek-mertebeden-bilesenlerine-higher-order-components-hocs-hizli-bir-giris\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"React&#8217;in Y\u00fcksek Mertebeden Bile\u015fenlerine (Higher-Order Components &#8211; HOCs) H\u0131zl\u0131 Bir Giri\u015f"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/32972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=32972"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/32972\/revisions"}],"predecessor-version":[{"id":32973,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/32972\/revisions\/32973"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=32972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=32972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=32972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}