{"id":2429,"date":"2024-09-06T13:17:02","date_gmt":"2024-09-06T12:17:02","guid":{"rendered":"https:\/\/codeflarelimited.com\/blog\/?p=2429"},"modified":"2024-09-06T17:29:15","modified_gmt":"2024-09-06T16:29:15","slug":"react-context-api","status":"publish","type":"post","link":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/","title":{"rendered":"Understanding React.js Context API"},"content":{"rendered":"\n<p>React.js is widely known for its component-based architecture, where data flows from parent to child components through props. However, as your application grows, passing props through multiple layers of components (prop drilling) can become complex and inefficient. This is where React&#8217;s Context API comes into play. It allows you to share state and data between components without passing props manually at every level. In this article, we&#8217;ll explore the React Context API, its benefits, and how to effectively use it in your React applications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>What is React Context API?<\/strong><\/h3>\n\n\n\n<p>The <strong>Context API<\/strong> is a feature in React that provides a way to pass data through the component tree without having to pass props manually at every level. It\u2019s especially useful for sharing global data like themes, user authentication, or settings across your entire app. The Context API works by creating a &#8220;context&#8221; that holds the shared data, which any component can access, regardless of its position in the component tree.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>When to Use Context API<\/strong><\/h3>\n\n\n\n<p>The <strong>Context API<\/strong> is ideal when:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>You need to avoid prop drilling and pass data across many levels of components.<\/li>\n\n\n\n<li>Global state management is required, like theming, authentication, or app-wide settings.<\/li>\n\n\n\n<li>You want a simpler alternative to state management libraries like Redux or MobX.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Basic Structure of Context API<\/strong><\/h3>\n\n\n\n<p>Using the <strong>Context API<\/strong> involves three key steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create a Context:<\/strong> This is where you define the shared data.<\/li>\n\n\n\n<li><strong>Provide the Context:<\/strong> A provider component makes the context available to other components.<\/li>\n\n\n\n<li><strong>Consume the Context:<\/strong> Any component can access the context\u2019s value using the <code>useContext<\/code> hook or the Context consumer.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">1. Creating a Context<\/h4>\n\n\n\n<p>First, you create a context using <code>React.createContext()<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React, { createContext } from 'react';\n\nconst ThemeContext = createContext('light');\n<\/code><\/pre>\n\n\n\n<p>Here, <code>ThemeContext<\/code> is created with a default value of <code>'light'<\/code>. You can pass any value, including objects or functions, as the default value.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. Providing the Context<\/h4>\n\n\n\n<p>Next, you need a <strong>Provider<\/strong> component to supply the context value to child components. The <strong>Provider<\/strong> wraps around the components that need access to the context.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React from 'react';\n\nconst App = () =&gt; {\n  return (\n    &lt;ThemeContext.Provider value=\"dark\"&gt;\n      &lt;Navbar \/&gt;\n      &lt;MainContent \/&gt;\n    &lt;\/ThemeContext.Provider&gt;\n  );\n};\n<\/code><\/pre>\n\n\n\n<p>Here, <code>ThemeContext.Provider<\/code> provides the value <code>'dark'<\/code> to its child components <code>Navbar<\/code> and <code>MainContent<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. Consuming the Context<\/h4>\n\n\n\n<p>There are two ways to access context:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using the <code>useContext<\/code> hook (for functional components).<\/li>\n\n\n\n<li>Using the <code>Context.Consumer<\/code> (for class components or older versions of React).<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Using <code>useContext<\/code> Hook:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React, { useContext } from 'react';\n\nconst Navbar = () =&gt; {\n  const theme = useContext(ThemeContext);\n\n  return (\n    &lt;nav className={theme === 'dark' ? 'navbar-dark' : 'navbar-light'}&gt;\n      &lt;h1&gt;My Website&lt;\/h1&gt;\n    &lt;\/nav&gt;\n  );\n};\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Using <code>Context.Consumer<\/code>:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React from 'react';\n\nconst Navbar = () =&gt; {\n  return (\n    &lt;ThemeContext.Consumer&gt;\n      {(theme) =&gt; (\n        &lt;nav className={theme === 'dark' ? 'navbar-dark' : 'navbar-light'}&gt;\n          &lt;h1&gt;My Website&lt;\/h1&gt;\n        &lt;\/nav&gt;\n      )}\n    &lt;\/ThemeContext.Consumer&gt;\n  );\n};\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example: Managing User Authentication with Context API<\/strong><\/h3>\n\n\n\n<p>Let&#8217;s use the <strong>Context API<\/strong> to manage user authentication across different components.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create the AuthContext:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React, { createContext, useState } from 'react';<br><br>export const AuthContext = createContext();<br><br>export const AuthProvider = ({ children }) =&gt; {<br>  const [user, setUser] = useState(null);<br><br>  const login = (username) =&gt; {<br>    setUser({ name: username });<br>  };<br><br>  const logout = () =&gt; {<br>    setUser(null);<br>  };<br><br>  return (<br>    &lt;AuthContext.Provider value={{ user, login, logout }}&gt;<br>      {children}<br>    &lt;\/AuthContext.Provider&gt;<br>  );<br>};<br><br><br><br><br><\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Wrap your app in the AuthProvider:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React from 'react';\nimport { AuthProvider } from '.\/AuthContext';\nimport AppContent from '.\/AppContent';\n\nconst App = () =&gt; {\n  return (\n    &lt;AuthProvider&gt;\n      &lt;AppContent \/&gt;\n    &lt;\/AuthProvider&gt;\n  );\n};\n\nexport default App;\n<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Consume the context in your components<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">import React, { useContext } from 'react';\nimport { AuthContext } from '.\/AuthContext';\n\nconst AppContent = () =&gt; {\n  const { user, login, logout } = useContext(AuthContext);\n\n  return (\n    &lt;div&gt;\n      {user ? (\n        &lt;div&gt;\n          &lt;h1&gt;Welcome, {user.name}&lt;\/h1&gt;\n          &lt;button onClick={logout}&gt;Logout&lt;\/button&gt;\n        &lt;\/div&gt;\n      ) : (\n        &lt;div&gt;\n          &lt;h1&gt;Please Log In&lt;\/h1&gt;\n          &lt;button onClick={() =&gt; login('John Doe')}&gt;Login&lt;\/button&gt;\n        &lt;\/div&gt;\n      )}\n    &lt;\/div&gt;\n  );\n};\n\nexport default AppContent;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Advantages of React Context API<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Simplified Prop Management<\/strong>: No more prop drilling across multiple layers of components.<\/li>\n\n\n\n<li><strong>Lightweight State Management<\/strong>: It provides a simpler alternative to state management libraries like Redux.<\/li>\n\n\n\n<li><strong>Reusable Across Components<\/strong>: Context values can be accessed anywhere within the provider&#8217;s tree, allowing flexible data sharing.<\/li>\n\n\n\n<li><strong>Improves Code Readability<\/strong>: By centralizing state and data, the Context API improves the readability and maintainability of your code.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p>The React Context API is a powerful tool for managing global state and avoiding prop drilling in your React applications. It simplifies the process of passing data between deeply nested components and provides a more maintainable approach to state management. Whether you&#8217;re managing themes, user authentication, or other global states, the Context API is an effective solution that can enhance the performance and structure of your React applications.<\/p>\n\n\n\n<p><a href=\"https:\/\/codeflarelimited.com\/blog\/reacts-suspense-and-concurrent-mode\/\">React&#8217;s Suspense and Concurrent Mode<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>React.js is widely known for its component-based architecture, where data flows from parent to child components through props.<\/p>\n","protected":false},"author":3,"featured_media":2438,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[73],"tags":[99],"class_list":["post-2429","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-react-js","tag-software-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>React Context API<\/title>\n<meta name=\"description\" content=\"Learn how the React Context API simplifies state management and avoids prop drilling by sharing data across components in your React App\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codeflarelimited.com\/blog\/react-context-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React Context API\" \/>\n<meta property=\"og:description\" content=\"Learn how the React Context API simplifies state management and avoids prop drilling by sharing data across components in your React App\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codeflarelimited.com\/blog\/react-context-api\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-06T12:17:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-06T16:29:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1120\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Kene Samuel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/\"},\"author\":{\"name\":\"Kene Samuel\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/c501609bab46c16807eb32106074f206\"},\"headline\":\"Understanding React.js Context API\",\"datePublished\":\"2024-09-06T12:17:02+00:00\",\"dateModified\":\"2024-09-06T16:29:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/\"},\"wordCount\":543,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240906-WA0003.jpg\",\"keywords\":[\"software development\"],\"articleSection\":[\"react js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/\",\"name\":\"React Context API\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240906-WA0003.jpg\",\"datePublished\":\"2024-09-06T12:17:02+00:00\",\"dateModified\":\"2024-09-06T16:29:15+00:00\",\"description\":\"Learn how the React Context API simplifies state management and avoids prop drilling by sharing data across components in your React App\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240906-WA0003.jpg\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/IMG-20240906-WA0003.jpg\",\"width\":1120,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-context-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"react js\",\"item\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/react-js\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Understanding React.js Context API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"name\":\"\",\"description\":\"Sustainable solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#organization\",\"name\":\"Codeflare Limited\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"contentUrl\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/codeflare.png\",\"width\":1040,\"height\":263,\"caption\":\"Codeflare Limited\"},\"image\":{\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/#\\\/schema\\\/person\\\/c501609bab46c16807eb32106074f206\",\"name\":\"Kene Samuel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g\",\"caption\":\"Kene Samuel\"},\"url\":\"https:\\\/\\\/codeflarelimited.com\\\/blog\\\/author\\\/kene\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"React Context API","description":"Learn how the React Context API simplifies state management and avoids prop drilling by sharing data across components in your React App","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:\/\/codeflarelimited.com\/blog\/react-context-api\/","og_locale":"en_US","og_type":"article","og_title":"React Context API","og_description":"Learn how the React Context API simplifies state management and avoids prop drilling by sharing data across components in your React App","og_url":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/","article_published_time":"2024-09-06T12:17:02+00:00","article_modified_time":"2024-09-06T16:29:15+00:00","og_image":[{"width":1120,"height":630,"url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg","type":"image\/jpeg"}],"author":"Kene Samuel","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#article","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/"},"author":{"name":"Kene Samuel","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/c501609bab46c16807eb32106074f206"},"headline":"Understanding React.js Context API","datePublished":"2024-09-06T12:17:02+00:00","dateModified":"2024-09-06T16:29:15+00:00","mainEntityOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/"},"wordCount":543,"commentCount":0,"publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg","keywords":["software development"],"articleSection":["react js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codeflarelimited.com\/blog\/react-context-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/","url":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/","name":"React Context API","isPartOf":{"@id":"https:\/\/codeflarelimited.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#primaryimage"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#primaryimage"},"thumbnailUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg","datePublished":"2024-09-06T12:17:02+00:00","dateModified":"2024-09-06T16:29:15+00:00","description":"Learn how the React Context API simplifies state management and avoids prop drilling by sharing data across components in your React App","breadcrumb":{"@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codeflarelimited.com\/blog\/react-context-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#primaryimage","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg","width":1120,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/codeflarelimited.com\/blog\/react-context-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codeflarelimited.com\/blog\/"},{"@type":"ListItem","position":2,"name":"react js","item":"https:\/\/codeflarelimited.com\/blog\/react-js\/"},{"@type":"ListItem","position":3,"name":"Understanding React.js Context API"}]},{"@type":"WebSite","@id":"https:\/\/codeflarelimited.com\/blog\/#website","url":"https:\/\/codeflarelimited.com\/blog\/","name":"","description":"Sustainable solutions","publisher":{"@id":"https:\/\/codeflarelimited.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codeflarelimited.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codeflarelimited.com\/blog\/#organization","name":"Codeflare Limited","url":"https:\/\/codeflarelimited.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","contentUrl":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2020\/11\/codeflare.png","width":1040,"height":263,"caption":"Codeflare Limited"},"image":{"@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/codeflarelimited.com\/blog\/#\/schema\/person\/c501609bab46c16807eb32106074f206","name":"Kene Samuel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3e1716cd715a5b5491e1f2da373b52f2f73aeb37d268baff34719116e386d848?s=96&d=mm&r=g","caption":"Kene Samuel"},"url":"https:\/\/codeflarelimited.com\/blog\/author\/kene\/"}]}},"jetpack_featured_media_url":"https:\/\/codeflarelimited.com\/blog\/wp-content\/uploads\/2024\/09\/IMG-20240906-WA0003.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/comments?post=2429"}],"version-history":[{"count":1,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2429\/revisions"}],"predecessor-version":[{"id":2430,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/posts\/2429\/revisions\/2430"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media\/2438"}],"wp:attachment":[{"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/media?parent=2429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/categories?post=2429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeflarelimited.com\/blog\/wp-json\/wp\/v2\/tags?post=2429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}