<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Function-Components on Ghafoor's Personal Blog</title><link>http://ghafoorsblog.com/tags/function-components/</link><description>Recent content in Function-Components on Ghafoor's Personal Blog</description><generator>Hugo</generator><language>en</language><managingEditor>noreply@example.com (AG Sayyed)</managingEditor><webMaster>noreply@example.com (AG Sayyed)</webMaster><copyright>Copyright © 2024-2026 AG Sayyed. All Rights Reserved.</copyright><lastBuildDate>Sat, 15 Nov 2025 18:14:57 +0000</lastBuildDate><atom:link href="http://ghafoorsblog.com/tags/function-components/index.xml" rel="self" type="application/rss+xml"/><item><title>Component Composition</title><link>http://ghafoorsblog.com/courses/ibm/fullstack-content/fullstack-pcert/05-frontend-react/02-module/002-component-composition/</link><pubDate>Tue, 29 Jul 2025 07:54:24 +0000</pubDate><author>noreply@example.com (AG Sayyed)</author><guid>http://ghafoorsblog.com/courses/ibm/fullstack-content/fullstack-pcert/05-frontend-react/02-module/002-component-composition/</guid><description>&lt;p class="lead text-primary"&gt;
This document explores how React component composition enables building complex UIs from smaller, reusable function components. It covers abstraction, reusability, hierarchy, props, children, and higher-order components, with practical examples for clarity.
&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="component-composition-in-react"&gt;Component Composition in React&lt;/h2&gt;
&lt;p&gt;Component composition is the process of combining multiple smaller components to create more complex functionality and larger UI structures. This approach allows developers to build applications using small, focused building blocks.&lt;/p&gt;
&lt;h3 id="principles-of-function-component-composition"&gt;Principles of Function Component Composition&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Abstraction:&lt;/strong&gt; Create reusable components that encapsulate specific UI features, breaking down large interfaces into manageable pieces.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reusability:&lt;/strong&gt; Avoid code duplication by reusing components across different parts of the application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hierarchy:&lt;/strong&gt; Arrange components in parent-child relationships, supporting modular and organized design.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Props and Children:&lt;/strong&gt; Pass data and even entire components as props or children, enabling flexible composition.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Higher-Order Components (HOCs):&lt;/strong&gt; Write functions that accept components as input or return enhanced components, adding features like state management or logic without modifying the original implementation.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="example-composing-a-blog-post-ui"&gt;Example: Composing a Blog Post UI&lt;/h2&gt;
&lt;p&gt;Below is a practical example demonstrating these principles. Each component encapsulates a specific feature of a blog post, such as title, author, type, and description.&lt;/p&gt;</description></item><item><title>Function Component</title><link>http://ghafoorsblog.com/courses/ibm/fullstack-content/fullstack-pcert/05-frontend-react/02-module/001-function-component/</link><pubDate>Tue, 29 Jul 2025 07:41:04 +0000</pubDate><author>noreply@example.com (AG Sayyed)</author><guid>http://ghafoorsblog.com/courses/ibm/fullstack-content/fullstack-pcert/05-frontend-react/02-module/001-function-component/</guid><description>&lt;p class="lead text-primary"&gt;
This document explores how React function components use props to pass data, set default values, and handle events. It covers the principles of reusability, unidirectional data flow, customization, and composition, as well as practical event handling and conditional rendering techniques.
&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="working-with-function-components--props-and-event-handling"&gt;Working with Function Components – Props and Event Handling&lt;/h2&gt;
&lt;p&gt;Function components in React use properties, known as props, to pass data from parent to child components. Props are similar to objects and store the attributes of a component. They are immutable, meaning their values cannot be changed by the child component.&lt;/p&gt;</description></item></channel></rss>