<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Azizi Yazit</title>
    <description>The latest articles on DEV Community by Azizi Yazit (@aziziyazit).</description>
    <link>https://dev.to/aziziyazit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F150946%2Fbad3a56e-799b-4502-8847-5d5ee228dafc.jpg</url>
      <title>DEV Community: Azizi Yazit</title>
      <link>https://dev.to/aziziyazit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aziziyazit"/>
    <language>en</language>
    <item>
      <title>From Scrum to Extreme Scrum: How to Supercharge Agile Teams</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Sun, 05 Oct 2025 10:32:01 +0000</pubDate>
      <link>https://dev.to/aziziyazit/from-scrum-to-extreme-scrum-how-to-supercharge-agile-teams-5ddg</link>
      <guid>https://dev.to/aziziyazit/from-scrum-to-extreme-scrum-how-to-supercharge-agile-teams-5ddg</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Scrum has become the go-to framework for Agile teams worldwide. Its ceremonies, roles, and artifacts provide structure and rhythm, enabling teams to deliver value in short, iterative cycles. Yet many organizations find themselves frustrated—daily stand-ups often feel like status updates disconnected from real changes in the codebase, sprint reviews frequently deliver feedback too late, end-to-end automation is skipped, and the promise of agility gets buried under rigid processes.&lt;/p&gt;

&lt;p&gt;That’s where Extreme Scrum (XS) comes in. Born from the need to address these gaps, XS builds on the foundations of Scrum and strengthens them with proven practices from Extreme Programming, Trunk-Based Development, Component-Driven Development, and Acceptance Test–Driven Development. The result is a methodology designed to maximize collaboration, accelerate feedback loops, and elevate code quality to the next level.&lt;/p&gt;

&lt;p&gt;In this article, I’ll share how XS transforms traditional Scrum into a high-impact framework—replacing daily stand-ups with daily code reviews, embedding continuous automation and testing into the workflow, and fostering closer collaboration between developers, automation engineers, and product owners. If you’ve ever felt that Scrum alone isn’t enough to supercharge your team, XS may be the solution you’re looking for.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scrum:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hl7ic337tkwdi89z2a5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hl7ic337tkwdi89z2a5.png" alt="Scrum" width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Extreme Scrum (XS)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxl4l7thx4rkx0j7i2c2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxl4l7thx4rkx0j7i2c2.png" alt="XS" width="800" height="652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Daily Code Standup – Driving Continuous Integration
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Extreme Scrum (XS)&lt;/strong&gt;, the traditional daily stand-up is replaced with a &lt;strong&gt;Daily Code Standup&lt;/strong&gt;. Instead of giving status updates, the team reviews the actual code changes committed in the last 24 hours. This shifts the focus from &lt;em&gt;what each person is doing&lt;/em&gt; to &lt;em&gt;what has changed in the product&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Daily Code Standup works hand-in-hand with &lt;strong&gt;Trunk-Based Development (TBD)&lt;/strong&gt;. Since every developer commits small, incremental changes directly to the main branch on a daily basis, the team always has a single, up-to-date codebase to review. This ensures that discussions are grounded in the latest, working code and that feedback loops stay extremely short.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1grc00nnu5zkla8pf80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1grc00nnu5zkla8pf80.png" alt="TBD" width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Key benefits of a Daily Code Standup:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code-centric discussions&lt;/strong&gt; – Conversations are grounded in real, recent commits rather than abstract updates.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Early feedback&lt;/strong&gt; – Potential issues, design flaws, or duplication are caught within a day.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Team-wide pair programming&lt;/strong&gt; – Everyone gains visibility into the evolving codebase, similar to continuous peer review.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Higher accountability&lt;/strong&gt; – Each developer explains their commits, promoting ownership and shared understanding.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By combining &lt;strong&gt;Daily Code Standups&lt;/strong&gt; with &lt;strong&gt;Trunk-Based Development&lt;/strong&gt;, XS creates a rhythm of continuous integration, immediate feedback, and collective ownership—ensuring faster learning, higher quality, and stronger collaboration across the team.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pair Programming vs. Team-Wide Pair Programming
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Pair Programming&lt;/th&gt;
&lt;th&gt;Team-Wide Pair Programming (Extreme Scrum)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who is involved&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2 developers (Driver + Navigator)&lt;/td&gt;
&lt;td&gt;Entire team reviewing each other’s daily commits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Focus&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A single feature or task&lt;/td&gt;
&lt;td&gt;The entire evolving codebase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Knowledge sharing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Between the two developers&lt;/td&gt;
&lt;td&gt;Distributed across the whole team&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Feedback loop&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Immediate but limited to the pair&lt;/td&gt;
&lt;td&gt;Immediate and collective, during Daily Code Standup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Accountability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Shared between two&lt;/td&gt;
&lt;td&gt;Shared across the entire team&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Works well for small tasks&lt;/td&gt;
&lt;td&gt;Scales to teams, ensures everyone stays aligned&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Analogy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Two people writing code together&lt;/td&gt;
&lt;td&gt;Everyone “pairing” with everyone else, every day&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;By scaling the principles of pair programming to the entire team, &lt;strong&gt;Team-Wide Pair Programming&lt;/strong&gt; ensures broader knowledge sharing, collective ownership, and higher code quality than traditional pair programming alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Desk Checks
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Extreme Scrum (XS)&lt;/strong&gt;, a &lt;strong&gt;Desk Check&lt;/strong&gt; is a lightweight, mini–Sprint Review that occurs &lt;em&gt;frequently during the sprint&lt;/em&gt; rather than only at the end. Desk Checks ensure that feedback flows continuously, reducing the risk of late surprises and strengthening collaboration between developers, Product Owners, and Testers.  &lt;/p&gt;

&lt;p&gt;There are two types of Desk Checks:  &lt;/p&gt;

&lt;h3&gt;
  
  
  1. Desk Check with the Product Owner (PO) – Driving Early and Continuous Feedback
&lt;/h3&gt;

&lt;p&gt;This session focuses on validating direction, usability, and value. Instead of waiting until the sprint review, developers showcase &lt;strong&gt;work-in-progress slices&lt;/strong&gt; of a feature.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: If the task is &lt;em&gt;Developing a Login Page&lt;/em&gt;, the developer can first show the &lt;strong&gt;layout and alignment&lt;/strong&gt; of text fields and buttons, then later demonstrate &lt;strong&gt;validation rules&lt;/strong&gt; for username and password.
&lt;/li&gt;
&lt;li&gt;The PO provides &lt;strong&gt;early feedback&lt;/strong&gt; on design choices, interactions, or copy, ensuring the product evolves in the right direction.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This incremental feedback loop saves time, reduces rework, and creates a tighter connection between developers and product stakeholders.  &lt;/p&gt;

&lt;h3&gt;
  
  
  2. Desk Check with Tester / Automation Engineer – Driving Continuous Test Automation
&lt;/h3&gt;

&lt;p&gt;This session centers around &lt;strong&gt;quality, testability, and automation readiness&lt;/strong&gt;. Instead of waiting for a “finished” feature, developers and testers treat each piece of functionality as a &lt;strong&gt;puzzle of the feature&lt;/strong&gt; that can be reviewed and tested incrementally.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: For the Login Page puzzle, one Desk Check could focus only on &lt;strong&gt;password validation logic&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;The Automation Engineer can start a &lt;strong&gt;contract testing discussion&lt;/strong&gt; with developers, covering details like &lt;strong&gt;data attributes&lt;/strong&gt; to be used in Cypress scripts or other automation frameworks.
&lt;/li&gt;
&lt;li&gt;Since code is committed daily (&lt;strong&gt;Trunk-Based Development&lt;/strong&gt;), Automation Engineers can immediately begin scripting &lt;strong&gt;automation tests for each puzzle&lt;/strong&gt;, rather than waiting for the full feature to be complete.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Benefits:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Faster automation readiness.
&lt;/li&gt;
&lt;li&gt;Earlier detection of design/testability issues.
&lt;/li&gt;
&lt;li&gt;Continuous collaboration between developers and testers, mirroring a &lt;em&gt;team-wide pair programming&lt;/em&gt; mindset.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Continuous Automation Testing
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Extreme Scrum (XS)&lt;/strong&gt;, automation testing is built into the process from the very beginning. It starts at &lt;strong&gt;EPIC grooming&lt;/strong&gt;, where the team defines the feature holistically along with its &lt;strong&gt;Acceptance Criteria&lt;/strong&gt;. From there, the EPIC is broken down into smaller stories through a process called &lt;strong&gt;Feature Breakdown&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;This approach is inspired by the &lt;strong&gt;Test-First philosophy&lt;/strong&gt; from &lt;strong&gt;Test Driven Development (TDD)&lt;/strong&gt; in Extreme Programming. While TDD focuses on writing unit tests before implementation, XS extends this mindset to the &lt;strong&gt;feature and acceptance level&lt;/strong&gt;—ensuring that testing considerations guide development from the start. In other words, XS is not strictly TDD, but it embraces the same principle: &lt;em&gt;tests come first, code follows&lt;/em&gt;.  &lt;/p&gt;

&lt;p&gt;Each EPIC carries an &lt;strong&gt;Acceptance Details Test (ADT)&lt;/strong&gt; for end-to-end (E2E) coverage, derived directly from its Acceptance Criteria. Likewise, each story is defined with its own ADT for &lt;strong&gt;Component Testing&lt;/strong&gt;. These tests are written in &lt;strong&gt;Gherkin (BDD) format&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gherkin"&gt;&lt;code&gt;&lt;span class="nf"&gt;Given &lt;/span&gt;[initial context]  
&lt;span class="nf"&gt;When &lt;/span&gt;[event occurs]  
&lt;span class="nf"&gt;Then &lt;/span&gt;[expected outcome]  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All stories with defined &lt;strong&gt;ADTs&lt;/strong&gt; are stored in the &lt;strong&gt;Acceptance Details Testing Backlog&lt;/strong&gt;, and it becomes mandatory that items in the &lt;strong&gt;Sprint Backlog&lt;/strong&gt; are selected from this backlog. This ensures testing is never an afterthought but an &lt;strong&gt;integral part of the development cycle&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;By having ADTs defined &lt;strong&gt;before coding begins&lt;/strong&gt;, both Developers and Testers are aligned on the test cases. As development starts, Testers can work &lt;strong&gt;in parallel&lt;/strong&gt; by scripting automation tests against the ADT. During &lt;strong&gt;Desk Checks&lt;/strong&gt;, Developers and Testers review, refine, and enhance the ADTs together.&lt;/p&gt;

&lt;p&gt;When subsequent stories (or “puzzles” of a larger feature) are developed, Desk Checks validate them against the automation scripts already written for earlier stories. This creates an &lt;strong&gt;immediate safety net&lt;/strong&gt;, ensuring no breaking changes slip through.&lt;/p&gt;

&lt;p&gt;To make this process smooth and incremental, &lt;strong&gt;XS leverages Trunk-Based Development techniques&lt;/strong&gt; like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Branch by Abstraction&lt;/strong&gt; – Allows developers to split a story into multiple incremental commits (abstractions and implementations), enabling handover in small, manageable steps.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature Toggles&lt;/strong&gt; – Let developers safely commit incomplete features to the mainline. Incomplete functionality is hidden from end users but exposed via toggle flags so Testers can enable it for automation scripting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach ensures that the &lt;strong&gt;mainline remains deployable on demand&lt;/strong&gt;, with no risk of unstable or partially complete features disrupting production—while fully embracing the &lt;strong&gt;test-first philosophy&lt;/strong&gt; to drive quality and agility.&lt;/p&gt;

&lt;h3&gt;
  
  
  XS Test-First vs TDD: What’s the Difference?
&lt;/h3&gt;

&lt;p&gt;While &lt;strong&gt;Extreme Scrum (XS)&lt;/strong&gt; borrows the &lt;em&gt;test-first philosophy&lt;/em&gt; from &lt;strong&gt;Test-Driven Development (TDD)&lt;/strong&gt;, the two approaches operate at different levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;TDD (Extreme Programming)&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Focuses on &lt;strong&gt;unit-level&lt;/strong&gt; tests.
&lt;/li&gt;
&lt;li&gt;Developers write a failing test first, then implement code until the test passes.
&lt;/li&gt;
&lt;li&gt;Cycle: &lt;em&gt;Red → Green → Refactor&lt;/em&gt;.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;XS Test-First&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Focuses on &lt;strong&gt;feature and acceptance-level&lt;/strong&gt; tests.
&lt;/li&gt;
&lt;li&gt;Tests are defined as &lt;strong&gt;Acceptance Details Tests (ADTs)&lt;/strong&gt; before coding begins.
&lt;/li&gt;
&lt;li&gt;Both Developers and Testers collaborate on automation scripts aligned with business outcomes.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;👉 In short: &lt;strong&gt;TDD validates correctness of code at the micro level&lt;/strong&gt;, while &lt;strong&gt;XS validates correctness of features at the macro (business) level&lt;/strong&gt;—both driven by the same philosophy: &lt;em&gt;tests guide development, not follow it&lt;/em&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  XS Test-First Flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flowchart TD
    A[EPIC Grooming] --&amp;gt; B[Feature Breakdown → Stories]
    B --&amp;gt; C[Define Acceptance Details Test (ADT)]
    C --&amp;gt; D[Developers &amp;amp; Testers Work in Parallel]
    D --&amp;gt; E[Desk Checks: Review &amp;amp; Refine ADTs]
    E --&amp;gt; F[Automation Scripts Validated]
    F --&amp;gt; G[Automation Safety Net (No Breaking Changes)]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Process Retrospective – Driving Objectivity and Continuous Improvement
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Extreme Scrum (XS)&lt;/strong&gt;, the &lt;strong&gt;Process Retrospective&lt;/strong&gt; is designed to focus squarely on the &lt;strong&gt;process itself&lt;/strong&gt;—not on individuals or vague feelings. The purpose is to evaluate whether each practice is working well, needs improvement, or requires replacement.  &lt;/p&gt;

&lt;p&gt;The retrospective documentation is structured into clear sections for every XS practice, such as &lt;strong&gt;Daily Code Standup, Desk Checks, Acceptance Details Tests (ADT), Trunk-Based Development&lt;/strong&gt;, and others. Participants provide feedback &lt;strong&gt;only within these defined sections&lt;/strong&gt;, ensuring discussions remain targeted and constructive.  &lt;/p&gt;

&lt;p&gt;This differs from a &lt;strong&gt;traditional Scrum retrospective&lt;/strong&gt;, which can sometimes drift into personal complaints, emotional venting, or even finger-pointing. While those conversations may have value, they often risk lowering team morale and derailing focus.  &lt;/p&gt;

&lt;p&gt;By anchoring the retrospective in &lt;strong&gt;process evaluation rather than personal critique&lt;/strong&gt;, XS promotes:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Objectivity over subjectivity&lt;/strong&gt; – Teams assess whether the &lt;em&gt;practice&lt;/em&gt; works, not whether a &lt;em&gt;person&lt;/em&gt; did something wrong.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Continuous tuning&lt;/strong&gt; – Each iteration allows processes to be refined, adjusted, or enhanced.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared ownership&lt;/strong&gt; – Everyone contributes to shaping the methodology, creating buy-in and alignment.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Over time, this approach builds a culture of &lt;strong&gt;systematic improvement&lt;/strong&gt;, where every process is tuned until the team is satisfied—and where retrospectives serve as a driver of progress rather than a drain on momentum.  &lt;/p&gt;

&lt;h3&gt;
  
  
  Traditional Scrum Retrospective vs XS Process Retrospective
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Traditional Scrum Retrospective&lt;/th&gt;
&lt;th&gt;XS Process Retrospective&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Focus&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Team feelings, individual performance, general issues&lt;/td&gt;
&lt;td&gt;Processes, practices, and workflows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Discussion Style&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Open-ended, may drift into personal complaints&lt;/td&gt;
&lt;td&gt;Structured, limited to predefined process sections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Feedback Timing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Typically at the end of the sprint&lt;/td&gt;
&lt;td&gt;Continuous, process-focused throughout the sprint&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Accountability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Can feel personal, sometimes leads to blame&lt;/td&gt;
&lt;td&gt;Objective, centered on practices rather than people&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Improvement Approach&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Subjective suggestions&lt;/td&gt;
&lt;td&gt;Systematic tuning of processes based on observations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Outcome&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Insights may vary; risk of lowered team momentum&lt;/td&gt;
&lt;td&gt;Actionable process improvements; momentum maintained&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Collaboration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Team reflects together, may focus on issues&lt;/td&gt;
&lt;td&gt;Everyone contributes to process refinement and alignment&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Example: A Day in Extreme Scrum (XS)
&lt;/h2&gt;

&lt;p&gt;Here’s how a typical day looks for an Extreme Scrum team:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Daily Code Standup (Continuous Integration)&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Team reviews commits from the last 24 hours.
&lt;/li&gt;
&lt;li&gt;Focus is on the &lt;strong&gt;mainline health&lt;/strong&gt;, not status updates.
&lt;/li&gt;
&lt;li&gt;Issues (conflicts, failing tests, duplication) are identified immediately.&lt;/li&gt;
&lt;li&gt;The team uses &lt;strong&gt;Branch by Abstraction&lt;/strong&gt; and &lt;strong&gt;Feature Toggles&lt;/strong&gt; to keep trunk stable.
&lt;/li&gt;
&lt;li&gt;Everyone gains visibility into evolving code during the &lt;strong&gt;Daily Code Standup&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Desk Check with the Product Owner (Continuous Feedback)&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developer showcases a &lt;strong&gt;work-in-progress slice&lt;/strong&gt; of a feature.
&lt;/li&gt;
&lt;li&gt;PO provides &lt;strong&gt;early feedback&lt;/strong&gt; on usability, flow, and alignment with business needs.
&lt;/li&gt;
&lt;li&gt;Example: reviewing just the &lt;strong&gt;form layout&lt;/strong&gt; or &lt;strong&gt;validation logic&lt;/strong&gt; of a login page.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Desk Check with the Tester / Automation Engineer (Continuous Automation Testing)&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tester and developer review &lt;strong&gt;Acceptance Details Tests (ADTs)&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Begin scripting &lt;strong&gt;automation tests in parallel&lt;/strong&gt; (e.g., Cypress).
&lt;/li&gt;
&lt;li&gt;Validate &lt;strong&gt;contract testing details&lt;/strong&gt; (e.g., data attributes, APIs).
&lt;/li&gt;
&lt;li&gt;Ensures each “puzzle” of the feature can be tested early.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Continuous Integration Pipeline&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every commit triggers &lt;strong&gt;unit, component, and E2E tests&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Earlier ADTs act as an &lt;strong&gt;automation safety net&lt;/strong&gt;, ensuring no regressions.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Continuous Delivery Mindset&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mainline is &lt;strong&gt;always deployable on demand&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;PO or stakeholders can enable toggled features to validate progress instantly.
&lt;/li&gt;
&lt;li&gt;Value is delivered continuously, not just at sprint reviews.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;A day in XS is not a rigid sequence of ceremonies but a &lt;strong&gt;continuous cycle of code, test, and feedback&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
It keeps everyone—Developers, Testers, and Product Owners—aligned around &lt;strong&gt;working software&lt;/strong&gt; and &lt;strong&gt;business outcomes&lt;/strong&gt;, every single day.&lt;br&gt;
&lt;em&gt;Thanks for reading! If you enjoyed this, follow me for more dev process experiments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agile</category>
      <category>management</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Higher Order Component enabled by Ivy</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Tue, 17 Dec 2019 16:47:29 +0000</pubDate>
      <link>https://dev.to/aziziyazit/higher-order-component-enabled-by-ivy-37jn</link>
      <guid>https://dev.to/aziziyazit/higher-order-component-enabled-by-ivy-37jn</guid>
      <description>&lt;h2&gt;
  
  
  Higher Order Component - HOC
&lt;/h2&gt;

&lt;p&gt;A higher-order component (HOC) is an advanced technique for reusing component logic. Concretely, a higher-order component is a function that takes a component and returns a new component.&lt;/p&gt;

&lt;h3&gt;
  
  
  Angular HOC
&lt;/h3&gt;

&lt;p&gt;Below is sample HOC withTheme and obviously the code received the component, insert the theme data and return decorated component. Annotated or attached the HOC to the class component is called meta-programming using typescript decorator.&lt;/p&gt;

&lt;p&gt;Meta-programming is a technique by which you can modify the code dynamically at runtime.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fpu1iuigy57e403tnb31j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fpu1iuigy57e403tnb31j.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And below is the HOC usage&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwrvh43c73ykd7piv6jrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwrvh43c73ykd7piv6jrq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Be creative
&lt;/h3&gt;

&lt;p&gt;Ivy is enabler, it enabled HOC and Meta-programming. Be creative, there's so many use-cases can be cater by HOC.&lt;/p&gt;

&lt;p&gt;Here is an example of enabling CSS-in-JS using HOC withStyles&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbyjbku3s4d5ucz0euluv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbyjbku3s4d5ucz0euluv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here is some ideas:&lt;/p&gt;

&lt;h4&gt;
  
  
  withAuth
&lt;/h4&gt;

&lt;p&gt;return auth data if user have been authenticated&lt;/p&gt;

&lt;h4&gt;
  
  
  withRouter
&lt;/h4&gt;

&lt;p&gt;return a router data&lt;/p&gt;

&lt;h4&gt;
  
  
  withProvider
&lt;/h4&gt;

&lt;p&gt;return provider reference&lt;/p&gt;

&lt;h3&gt;
  
  
  Code repository
&lt;/h3&gt;

&lt;p&gt;Check the codes here &lt;a href="https://github.com/abumuawiyah/ng-ivy" rel="noopener noreferrer"&gt;https://github.com/abumuawiyah/ng-ivy&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>ivy</category>
      <category>hoc</category>
      <category>cssinjs</category>
    </item>
    <item>
      <title>Angular theme provider</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Sat, 24 Aug 2019 18:04:18 +0000</pubDate>
      <link>https://dev.to/aziziyazit/angular-theme-provider-59pe</link>
      <guid>https://dev.to/aziziyazit/angular-theme-provider-59pe</guid>
      <description>&lt;p&gt;Providing a theme provider is a &lt;strong&gt;must&lt;/strong&gt; in a component library. All components should be able to gain access to the &lt;strong&gt;Theme Object&lt;/strong&gt;. This includes palettes, spacings, sizings, and more.  &lt;/p&gt;

&lt;p&gt;In Angular, providing the theme provider is easy to accomplish as Angular has this ability out of the box.&lt;/p&gt;

&lt;p&gt;In this post, we are using &lt;strong&gt;forwardRef&lt;/strong&gt; and &lt;strong&gt;ngTemplate&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  forwardRef
&lt;/h2&gt;

&lt;p&gt;Basically, &lt;a href="https://angular.io/api/core/forwardRef" rel="noopener noreferrer"&gt;forwardRef&lt;/a&gt; is a function that captures a class reference into a closure. By using &lt;code&gt;forwardRef&lt;/code&gt;, we can access the component reference and use it in other components.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Inject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;forwardRef&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;YourComponentName&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;yourComponentName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;YourComponentName&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt;##&lt;/span&gt; &lt;span class="nx"&gt;ng&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`ngTemplate`&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;can&lt;/span&gt; &lt;span class="nx"&gt;use&lt;/span&gt; &lt;span class="nx"&gt;properties&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;its&lt;/span&gt; &lt;span class="nx"&gt;parent&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;can&lt;/span&gt; &lt;span class="nx"&gt;have&lt;/span&gt; &lt;span class="nx"&gt;its&lt;/span&gt; &lt;span class="nx"&gt;own&lt;/span&gt; &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ng&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;parentData1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;data1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="kd"&gt;let&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;parentData2&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;data2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!--&lt;/span&gt; &lt;span class="nx"&gt;The&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;data1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;data2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;are&lt;/span&gt; &lt;span class="nx"&gt;available&lt;/span&gt; &lt;span class="nx"&gt;here&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ng-template&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/parent&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;In&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;above&lt;/span&gt; &lt;span class="nx"&gt;example&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="nx"&gt;data1&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="nx"&gt;data2&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;are&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;Parent&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="err"&gt;##&lt;/span&gt; &lt;span class="nx"&gt;ThemeProviderComponent&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`ThemeProviderComponent`&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="nx"&gt;or&lt;/span&gt; &lt;span class="nx"&gt;parent&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;other&lt;/span&gt; &lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;  
&lt;span class="nx"&gt;All&lt;/span&gt; &lt;span class="nx"&gt;components&lt;/span&gt; &lt;span class="nx"&gt;must&lt;/span&gt; &lt;span class="nx"&gt;be&lt;/span&gt; &lt;span class="nx"&gt;wrapped&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nx"&gt;provider&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;gain&lt;/span&gt; &lt;span class="nx"&gt;access&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="nx"&gt;object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;  
&lt;span class="nx"&gt;It&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt; &lt;span class="nx"&gt;highly&lt;/span&gt; &lt;span class="nx"&gt;recommended&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;wrap&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;entire&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;highest&lt;/span&gt; &lt;span class="nf"&gt;level &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;see&lt;/span&gt; &lt;span class="nx"&gt;below&lt;/span&gt;&lt;span class="p"&gt;):{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;provider&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;layout&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;grid&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/grid&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/layout&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/app&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/theme-provider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt;###&lt;/span&gt; &lt;span class="nx"&gt;ThemeProviderComponent&lt;/span&gt; &lt;span class="nx"&gt;snippet&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="nx"&gt;javascript&lt;/span&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;theme-provider&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`
    &amp;lt;ng-container *ngIf="childAsTemplate"&amp;gt;
      &amp;lt;ng-container *ngTemplateOutlet="template; context: theme"&amp;gt;&amp;lt;/ng-container&amp;gt;
    &amp;lt;/ng-container&amp;gt;
    &amp;lt;ng-content *ngIf="!childAsTemplate"&amp;gt;&amp;lt;/ng-content&amp;gt;
  `&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ThemeProviderComponent&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;AfterContentInit&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;ContentChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TemplateRef&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;static&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;TemplateRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;palette&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;scales&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="nl"&gt;childAsTemplate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

  &lt;span class="nf"&gt;ngAfterContentInit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;childAsTemplate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt;###&lt;/span&gt; &lt;span class="nx"&gt;palette&lt;/span&gt; &lt;span class="nx"&gt;snippet&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="nx"&gt;javascript&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;palette&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;uiBlueDarker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#071d40&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;uiBlueDark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0d3880&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;uiBlue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#184da8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;uiBlueLight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#2765cf&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;uiBlueLighter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#e60278&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="err"&gt;###&lt;/span&gt; &lt;span class="nx"&gt;scales&lt;/span&gt; &lt;span class="nx"&gt;snippet&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="nx"&gt;javascript&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;scales&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;spacing-01&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0.125rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;spacing-02&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0.25rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;spacing-03&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0.5rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;spacing-04&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0.75rem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="o"&gt;~~~&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="nx"&gt;palette&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="nx"&gt;scales&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;are&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt; &lt;span class="nx"&gt;provided&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;child&lt;/span&gt; &lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; usage.

## Usages

### Used in a Component

In this example, we create a button component that accepts {% raw %}`color` and `scale` as inputs and uses the theme object provided by `ThemeProviderComponent` for **palette** and **scales** values.

~~~javascript
@Component({
  selector: "my-button",
  template: `
    &amp;lt;button
      type="button"
      [style.color]="themeProvider?.theme?.palette[color]"
      [style.fontSize]="themeProvider?.theme?.scales[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;spacing&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; + scale]"
    &amp;gt;
      &amp;lt;ng-content&amp;gt;&amp;lt;/ng-content&amp;gt;
    &amp;lt;/button&amp;gt;
  `
})
export class MyButtonComponent {
  @HostBinding("class") className;
  @Input() color!: string;
  @Input() scale!: number;

  constructor(
    @Inject(forwardRef(() =&amp;gt; ThemeProviderComponent))
    private themeProvider: ThemeProviderComponent
  ) {}
}
~~~

&amp;gt; We get a reference to `ThemeProviderComponent` using `forwardRef`.  
&amp;gt; In the template markup, we utilize the theme for `palette` and `scale`.

Below is an example usage of the `my-button` component:

~~~html
&amp;lt;theme-provider&amp;gt;
  &amp;lt;my-button [color]="&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;uiBlue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;" [scale]="9"&amp;gt;
    Button
  &amp;lt;/my-button&amp;gt;
&amp;lt;/theme-provider&amp;gt;
~~~

### Used in ngTemplate

In this example, we customize the `my-button` component and gain access to the theme object through `ngTemplate`:

~~~html
&amp;lt;theme-provider&amp;gt;
  &amp;lt;ng-template let-palette="palette" let-scales="scales"&amp;gt;
    &amp;lt;my-button&amp;gt;
      &amp;lt;div
        [style.color]="palette[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;uiYellow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;]"
        [style.backgroundColor]="palette[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;uiPink&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;]"
        [style.fontSize]="scales[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;spacing&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;09&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;]"
      &amp;gt;
        Button
      &amp;lt;/div&amp;gt;
    &amp;lt;/my-button&amp;gt;
  &amp;lt;/ng-template&amp;gt;
&amp;lt;/theme-provider&amp;gt;
~~~

## Summary

The theme provider lets us use the theme object (like **palette**, **spacing**, and **sizing**) in the scripting layer rather than the stylesheet layer.  
For those more comfortable styling components in JavaScript, this pattern can help speed up styling work.

You can get all the code used in this post here:  
👉 [https://stackblitz.com/edit/theme-provider](https://stackblitz.com/edit/theme-provider)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>angular</category>
      <category>themeprovider</category>
    </item>
    <item>
      <title>My first component in Angular - Box</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Wed, 07 Aug 2019 16:38:36 +0000</pubDate>
      <link>https://dev.to/aziziyazit/first-component-in-ui-lib-omf</link>
      <guid>https://dev.to/aziziyazit/first-component-in-ui-lib-omf</guid>
      <description>&lt;p&gt;&lt;b&gt;You can grab the code here&lt;/b&gt; &lt;a href="https://stackblitz.com/edit/flexboxcssinjs"&gt;https://stackblitz.com/edit/flexboxcssinjs&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Box
&lt;/h2&gt;

&lt;p&gt;All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout.&lt;/p&gt;

&lt;p&gt;The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content. The image below illustrates the box model&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rCq7gAoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ak08y8j1p19rcbvva5rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rCq7gAoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ak08y8j1p19rcbvva5rw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In every design system that I made, Box component is the first component that I developed.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We uses Angular and emotionJS (CSS-in-JS) for code example.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Box component code (snippet version)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--07_ax_g8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nvw3iz8drgic1y6wr9d9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--07_ax_g8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nvw3iz8drgic1y6wr9d9.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Box component can be implemented as simple as this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Box&lt;/span&gt; &lt;span class="na"&gt;p=&lt;/span&gt;&lt;span class="s"&gt;"20px 20px"&lt;/span&gt; &lt;span class="na"&gt;ml=&lt;/span&gt;&lt;span class="s"&gt;"10px"&lt;/span&gt; &lt;span class="na"&gt;mr=&lt;/span&gt;&lt;span class="s"&gt;"10px"&lt;/span&gt; &lt;span class="na"&gt;w=&lt;/span&gt;&lt;span class="s"&gt;"200px"&lt;/span&gt; &lt;span class="na"&gt;h=&lt;/span&gt;&lt;span class="s"&gt;"auto"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 Content
&lt;span class="nt"&gt;&amp;lt;/Box&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Please note that we are not using &lt;b&gt;brackets [rule]="value"&lt;/b&gt; as we are expecting literal string.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And we can extend the Box to create other component e.g Flexbox&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WyA1Kdek--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/en5z0jos367oi7epb4ru.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WyA1Kdek--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/en5z0jos367oi7epb4ru.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By using Flexbox component, creating a flexbox is not an issue anymore&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Flexbox&lt;/span&gt; &lt;span class="na"&gt;w=&lt;/span&gt;&lt;span class="s"&gt;"100vw"&lt;/span&gt; &lt;span class="na"&gt;justifyContent=&lt;/span&gt;&lt;span class="s"&gt;"space-between"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Box&lt;/span&gt; &lt;span class="na"&gt;w=&lt;/span&gt;&lt;span class="s"&gt;"50px"&lt;/span&gt; &lt;span class="na"&gt;h=&lt;/span&gt;&lt;span class="s"&gt;"50px"&lt;/span&gt; &lt;span class="na"&gt;bgColor=&lt;/span&gt;&lt;span class="s"&gt;"rebeccapurple"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Box&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Box&lt;/span&gt; &lt;span class="na"&gt;w=&lt;/span&gt;&lt;span class="s"&gt;"50px"&lt;/span&gt; &lt;span class="na"&gt;h=&lt;/span&gt;&lt;span class="s"&gt;"50px"&lt;/span&gt; &lt;span class="na"&gt;bgColor=&lt;/span&gt;&lt;span class="s"&gt;"rebeccapurple"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Box&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Box&lt;/span&gt; &lt;span class="na"&gt;w=&lt;/span&gt;&lt;span class="s"&gt;"50px"&lt;/span&gt; &lt;span class="na"&gt;h=&lt;/span&gt;&lt;span class="s"&gt;"50px"&lt;/span&gt; &lt;span class="na"&gt;bgColor=&lt;/span&gt;&lt;span class="s"&gt;"rebeccapurple"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Box&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Flexbox&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We can also do a checking on the value and helps developer to identify the typo (me myself is not kind of person who remember all the rule values)&lt;/p&gt;

&lt;p&gt;Here is an example how to add simple validation on values. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eaxAkwg7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0ck1at4pyfn2igj2mb1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eaxAkwg7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0ck1at4pyfn2igj2mb1k.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In above example we check the value of justifyContent and only if its a valid value, the justifyContent rule added into style. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Box component can be Base component to other components e.g. Semantic Components like &lt;b&gt;section&lt;/b&gt;, &lt;b&gt;header&lt;/b&gt;, &lt;b&gt;article&lt;/b&gt;, &lt;b&gt;nav&lt;/b&gt; and many more...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Semantic components
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;SectionComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;BoxComponent&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;&lt;br&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;HeaderComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;BoxComponent&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;&lt;br&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ArticleComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;BoxComponent&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;&lt;br&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;NavComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;BoxComponent&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Summary&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;Abstracting the Box component as a Base component will make our life easier because all the components of HTML can be considered as a boxes. Like Box component, all the HTML elements (boxes) is consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;Content&lt;/b&gt; The content of the box, where text and images appear&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;Padding&lt;/b&gt; Clears an area around the content. The padding is transparent&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;Border&lt;/b&gt; A border that goes around the padding and content&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;Margin&lt;/b&gt; Clears an area outside the border. The margin is transparent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By extending the Box component, all mentioned above have been covered. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>cssinjs</category>
      <category>emotionjs</category>
    </item>
    <item>
      <title>Performance optimizations in React</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Tue, 06 Aug 2019 16:52:34 +0000</pubDate>
      <link>https://dev.to/aziziyazit/performance-optimizations-in-react-1aph</link>
      <guid>https://dev.to/aziziyazit/performance-optimizations-in-react-1aph</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;In computing, memoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again&lt;br&gt;
~wikipedia&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;React used Virtual DOM to reduce browser reflow and repaint using diff algorithm called "Reconciliation". "Reconciliation" is fast but when we have too many of them (re-renders), its too costly and we should plan for optimization.&lt;/p&gt;

&lt;p&gt;React have 2 built-in hooks to prevent unnecessary renders in component that rely on reference equality. And to avoid recompute expensive calculations. Those hooks is useMemo and useCallback. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Reference equality&lt;/b&gt; means that two object references refer to the same underlying object.&lt;/p&gt;

&lt;p&gt;An experienced JavaScript developer know that below code is return &lt;b&gt;false&lt;/b&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Example of &lt;b&gt;expensive calculation&lt;/b&gt; is checking for prime number&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;isPrime&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;without memoization, I can't imagine that the function above run/triggered every render. &lt;/p&gt;

&lt;h2&gt;
  
  
  useMemo hook
&lt;/h2&gt;

&lt;p&gt;useMemo will return a memoized version of the value (all types including function) that only changes if one of the dependencies has changed.&lt;/p&gt;

&lt;p&gt;Here is example use-case of useMemo&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3JUXuXkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vxk5thoeqns4zvycucol.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3JUXuXkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vxk5thoeqns4zvycucol.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the &lt;b&gt;memoizedTasks&lt;/b&gt; only triggered a render when there is a changes in &lt;b&gt;tasks&lt;/b&gt; state. You can see the console.log only triggered when tasks state changed.&lt;/p&gt;

&lt;p&gt;Any changes to others state in statisticModuleContext will not causing re-render of TodoList.&lt;/p&gt;

&lt;h2&gt;
  
  
  useCallback hook
&lt;/h2&gt;

&lt;p&gt;useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed.&lt;/p&gt;

&lt;p&gt;And both useMemo and useCallback can behave similarly:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;useCallback(fn, deps) is equivalent to useMemo(() =&amp;gt; fn, deps).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However, usually useCallback used for parent-child component. &lt;/p&gt;

&lt;h3&gt;
  
  
  parent-child component
&lt;/h3&gt;

&lt;p&gt;When we have identified a parent component that have a high possibility to re-renders a lots, we can use useCallback to prevent unnecessary re-render of the child. &lt;/p&gt;

&lt;p&gt;Consider below code examples (i took the example from Kent C Dodds article as to me its the most clear example)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CZ8aSd7F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7fnaiito8po13ri7urh8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CZ8aSd7F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/7fnaiito8po13ri7urh8.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DualCounter is the parent component that have CountButton as a children. When DualCounter is re-rendered, its functions (increment1 and increment2) will be renew/reinitiated and causing re-render of the CountButton. This is because the increment1 and increment2 is the child &lt;b&gt;dependency&lt;/b&gt;. &lt;/p&gt;

&lt;p&gt;By using useCallback and without function dependency changes, we be able to prevent the unnecessary re-render of the CountButton as the functions have been memoized. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k8oCjSC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mp05orc23dkliy5ys821.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k8oCjSC---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mp05orc23dkliy5ys821.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please aware that optimization comes with price and should only be used on a VALID use-cases as we mentioned above.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;React is VERY fast and there are so many things I can think of for you to do with your time that would be better than optimizing things&lt;br&gt;
~Kent C Dodds&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>React as State Management Library</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Tue, 30 Jul 2019 14:51:00 +0000</pubDate>
      <link>https://dev.to/aziziyazit/state-management-in-react-4op9</link>
      <guid>https://dev.to/aziziyazit/state-management-in-react-4op9</guid>
      <description>&lt;h2&gt;
  
  
  State
&lt;/h2&gt;

&lt;p&gt;In the context of User Interface (UI), state is data that hold current information that influences the output of render. Its changed over time.&lt;/p&gt;

&lt;p&gt;State is user define, so its not only related to component or UI control.&lt;/p&gt;

&lt;h2&gt;
  
  
  State management library
&lt;/h2&gt;

&lt;p&gt;State management refers to managing the UI states. As applications grow, this can end up becoming one of the most complex problems in UI development.&lt;/p&gt;

&lt;p&gt;State management library provide us ability to store the states and exposing an API for UI components across application to access, add and update the states. Example of state management libraries is React (this is not typo) and Redux. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G7l8frI8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tc2tdn7eurdhzej3bwle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G7l8frI8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tc2tdn7eurdhzej3bwle.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Redux
&lt;/h3&gt;

&lt;p&gt;Redux attempts to make state mutations predictable by imposing certain restrictions on how and when updates can happen. These restrictions are reflected in the three principles of Redux (Single source of truth, State is read-only and Changes are made with pure functions).&lt;/p&gt;

&lt;h3&gt;
  
  
  React as state management library
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;If you're building an application with React, you already have a state management library installed in your application. You don't even need to npm install (or yarn add) it. It costs no extra bytes for your users, it integrates with all React packages on npm, and it's already well documented by the React team. It's React itself.&lt;br&gt;
~ Kent C. Dodds&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The question now, did we need Redux?&lt;br&gt;
You can find the answer in React doc&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2bbG-Uqi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ukrwc7xxe2t5fi9ydmxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2bbG-Uqi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ukrwc7xxe2t5fi9ydmxr.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choosing the right state management library is quiet a critical decision. To choose the best for your scenario require an understanding of the "states"&lt;/p&gt;

&lt;h3&gt;
  
  
  component state
&lt;/h3&gt;

&lt;p&gt;State thats used in locally.&lt;/p&gt;

&lt;p&gt;For example button component that uses its clicked state to show loader and icon (both loader and icon is sub component of button)&lt;/p&gt;

&lt;p&gt;The button component can be illustrated &lt;a href="https://codepen.io/joshuaward/pen/oGZrWN"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Component state can be managed easily using useState hook.&lt;/p&gt;

&lt;h3&gt;
  
  
  module state
&lt;/h3&gt;

&lt;p&gt;State thats used across different components in module scope that they (the components) are invoked.&lt;/p&gt;

&lt;p&gt;For example listing module that have table component and pagination component. Table used pagination page selected state to changed its data display. &lt;/p&gt;

&lt;p&gt;The listing module can be illustrated &lt;a href="https://codepen.io/yasser-mas/pen/pyWPJd"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For managing module states, &lt;a href="https://dev.to/aziziyazit/create-module-in-react-5gg"&gt;we can use Context API with useReducer&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  page state
&lt;/h3&gt;

&lt;p&gt;State thats used across different modules in page scope. &lt;/p&gt;

&lt;p&gt;For example login module and sign up module that can be toggled based on user interaction their buttons&lt;/p&gt;

&lt;p&gt;The login/sign up module can be illustrated &lt;a href="https://codepen.io/hk95/pen/Kyrvrj"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React have solid technique to manage state in page called &lt;a href="https://dev.to/aziziyazit/create-page-in-react-1mj6"&gt;lifting up state&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So far we have no issues managing 3 types of states (component, module and page) using &lt;b&gt;JUST React&lt;/b&gt;. Left is one more type of state, &lt;b&gt;global state&lt;/b&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  global state
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;User submit username and password (local state) in Login page, the loggedIn state (local state) used to show loader and redirect to Dashboard page with data like userId (global state?) passed along the way. userId used by menu module to get the user role and display menu item based on role provided.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Did the &lt;b&gt;userId&lt;/b&gt; can be considered as global state?&lt;br&gt;
No. Because it does not changed over time and it can be passed as prop.&lt;/p&gt;

&lt;p&gt;Data like &lt;b&gt;userId&lt;/b&gt; and others (same type) have been classified wrongly as global state. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You don’t need Redux if your data never changes. The whole point of it is managing changes. &lt;br&gt;
~ Dan Abramov&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When prop-drilling problem can be solved by using React (Context API), the only things I think useful to use Redux is managing global state. But when your application is composition of providers (modules) that have its own reducer managing the states on module scope, it seem we don't need global state. In other word, we don't need Redux anymore.&lt;/p&gt;

&lt;p&gt;A lots of info, tips and solution that can be seen &lt;a href="https://twitter.com/kentcdodds/status/1120445364325232640?lang=en"&gt;here&lt;/a&gt;. Peoples who involves in the discussion is the Kent C Dodds, Mark Erikson (Redux maintainer), Brian Lonsdorf and many other great React developers.&lt;/p&gt;

</description>
      <category>react</category>
      <category>statemanagement</category>
      <category>redux</category>
      <category>reactarchitecture</category>
    </item>
    <item>
      <title>CLI in React</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Fri, 26 Jul 2019 15:02:28 +0000</pubDate>
      <link>https://dev.to/aziziyazit/cli-in-react-4aik</link>
      <guid>https://dev.to/aziziyazit/cli-in-react-4aik</guid>
      <description>&lt;p&gt;Here’s your Markdown with proper formatting, fixed grammar, and cleaned-up section structure while preserving all content:&lt;/p&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CLI in React&lt;/span&gt;
&lt;span class="na"&gt;published&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Learn how to use a CLI tool with React to create consistent app, page, module, and component structures.&lt;/span&gt;
&lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;react, reactarchitecture, reactcli&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gu"&gt;## React and CLI&lt;/span&gt;

React has its own CLI, but currently, it only supports creating an app using &lt;span class="gs"&gt;**create-react-app**&lt;/span&gt;.  
&lt;span class="sb"&gt;`create-react-app`&lt;/span&gt; generates the boilerplate version of a React application via the command line.

&lt;span class="p"&gt;```&lt;/span&gt;&lt;span class="nl"&gt;
&lt;/span&gt;
bash
npx create-react-app my-app


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;create-react-app&lt;/code&gt; takes care of setting up the main structure of the application as well as several developer settings. Most of what you see will not be visible to visitors of your web app.&lt;br&gt;
React uses a tool called &lt;strong&gt;webpack&lt;/strong&gt;, which transforms the directories and files here into static assets. Visitors to your site are served those static assets.&lt;br&gt;
~ &lt;em&gt;codecademy.com&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each React app that you or your team creates will have the same structure — which is great for consistency across applications.&lt;/p&gt;

&lt;p&gt;However, UI development is not only about building apps; it also involves creating &lt;strong&gt;components&lt;/strong&gt;, &lt;strong&gt;modules&lt;/strong&gt;, and &lt;strong&gt;pages&lt;/strong&gt;. Developers should know what needs to be built by referring to the wireframe provided by the designer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3yyuqmxxtcrv7g17nli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3yyuqmxxtcrv7g17nli.png" alt="React structure example" width="752" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Without a defined structure, you can end up with a messy and inconsistent application.&lt;/p&gt;




&lt;h3&gt;
  
  
  Example Scenarios
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Dev 1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dashboard page&lt;/li&gt;
&lt;li&gt;Header component&lt;/li&gt;
&lt;li&gt;Card component&lt;/li&gt;
&lt;li&gt;Graph component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Dev 2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dashboard page&lt;/li&gt;
&lt;li&gt;Header module (container for search component, icons component, and dropdown component)&lt;/li&gt;
&lt;li&gt;Statistic module (container for one variant of the card component)&lt;/li&gt;
&lt;li&gt;Multi-variant Card compound component&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Dev 3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Admin page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If three developers work on the same project without a standard structure, you may get three different approaches — &lt;strong&gt;yuck!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A CLI for generating boilerplates (components, modules, and pages) provides the benefit of a &lt;strong&gt;consistent structure&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Setup the CLI
&lt;/h2&gt;

&lt;p&gt;We will use &lt;a href="https://plopjs.com/" rel="noopener noreferrer"&gt;plopJS&lt;/a&gt;, a micro-generator framework for the command line.&lt;br&gt;
PlopJS templates use the powerful &lt;a href="https://handlebarsjs.com/" rel="noopener noreferrer"&gt;Handlebars&lt;/a&gt; templating engine, which allows you to build semantic templates effectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Add plopJS into your &lt;code&gt;package.json&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
json
"devDependencies": {
  "plop": "^2.3.0"
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Install the dependency:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
bash
npm install


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  2. Define the Structure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Pages
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Page&lt;/strong&gt; is a container for modules. It manages communication between modules inside it.&lt;br&gt;
&lt;a href="https://dev.to/aziziyazit/create-page-in-react-1mj6"&gt;Read more about Pages&lt;/a&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
jsx
&amp;lt;Page&amp;gt;
  &amp;lt;ModuleA /&amp;gt;
  &amp;lt;ModuleB /&amp;gt;
&amp;lt;/Page&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Modules
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Module&lt;/strong&gt; is a container for components. It manages communication between the components inside it.&lt;br&gt;
&lt;a href="https://dev.to/aziziyazit/create-module-in-react-5gg"&gt;Read more about Modules&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
jsx
&amp;lt;Module&amp;gt;
  &amp;lt;ComponentA /&amp;gt;
  &amp;lt;ComponentB /&amp;gt;
&amp;lt;/Module&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Components
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Component&lt;/strong&gt; is a feature within a module.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
jsx
&amp;lt;ComponentA&amp;gt;
  &amp;lt;section&amp;gt;
    &amp;lt;article&amp;gt;
      Article
    &amp;lt;/article&amp;gt;
  &amp;lt;/section&amp;gt;
&amp;lt;/ComponentA&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  3. Create a &lt;code&gt;plopfile.js&lt;/code&gt; Configuration
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;plopfile.js&lt;/code&gt; in the same directory as &lt;code&gt;package.json&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
module.exports = function (plop) {
  plop.setGenerator('component', { ... });
  plop.setGenerator('module', { ... });
  plop.setGenerator('page', { ... });
};


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For this tutorial, we will focus on creating a generator for a &lt;strong&gt;component&lt;/strong&gt;.&lt;br&gt;
You can find complete generators &lt;a href="https://github.com/abumuawiyah/react-boilerplate" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Templates
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Script file&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9th9t6gn5hhnsgancuw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9th9t6gn5hhnsgancuw.png" width="800" height="578"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test file&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqx106al1ah1iuqfew3mr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqx106al1ah1iuqfew3mr.png" width="800" height="663"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Style file&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb1y3popfxpvrihk939rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb1y3popfxpvrihk939rk.png" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Index file&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tipqqj516zshv5fg7nc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tipqqj516zshv5fg7nc.png" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Save all the templates inside a &lt;code&gt;plop-templates&lt;/code&gt; folder.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. Create a Generator
&lt;/h2&gt;

&lt;p&gt;Here’s an example generator for a &lt;strong&gt;component&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fviyewhibm3kl2gvr6rwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fviyewhibm3kl2gvr6rwi.png" width="800" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once everything is ready, let’s test the generator.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add a new npm script named &lt;code&gt;"cmd"&lt;/code&gt; that runs &lt;code&gt;"npx plop"&lt;/code&gt;.&lt;br&gt;
If everything is set up correctly, you will see a list of generators to choose from.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mkte3tq6lomrgc2kxlx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mkte3tq6lomrgc2kxlx.png" width="800" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Start answering the prompts, and once completed, your component will be generated:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx86ahsfimxspv7bjrgcb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx86ahsfimxspv7bjrgcb.png" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Generated Files
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Card.js&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fug3fyaqu6gftyt4chr0j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fug3fyaqu6gftyt4chr0j.png" width="800" height="658"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Card.style.js&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87fqvjtdlu9d2q0jy2li.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87fqvjtdlu9d2q0jy2li.png" width="666" height="168"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Card.test.js&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbsv2srgytx6q8sxa9oy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbsv2srgytx6q8sxa9oy.png" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;index.js&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ei1ohq2u3s49kd45l4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ei1ohq2u3s49kd45l4t.png" width="750" height="140"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Using a CLI makes it easy to create apps, pages, modules, and components that follow the best practices and structure defined by you and your team.&lt;br&gt;
By automating component generation, you save development time and ensure consistency, allowing developers to focus on building features.&lt;/p&gt;

&lt;p&gt;📂 &lt;strong&gt;Full Source Code&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/abumuawiyah/react-boilerplate" rel="noopener noreferrer"&gt;https://github.com/abumuawiyah/react-boilerplate&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>react</category>
      <category>reactarchitecture</category>
      <category>reactcli</category>
    </item>
    <item>
      <title>Style Guide Driven Development</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Tue, 23 Jul 2019 15:44:57 +0000</pubDate>
      <link>https://dev.to/aziziyazit/style-guide-driven-development-using-angular-storybook-560b</link>
      <guid>https://dev.to/aziziyazit/style-guide-driven-development-using-angular-storybook-560b</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;"We are not designing pages, we are designing systems of components."&lt;br&gt;
~ Stephen Hay&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Style Guide Driven Development (SGDD)
&lt;/h2&gt;

&lt;p&gt;SGDD is about converting static style guide into dynamic style guide from the earliest stages of User Interface (UI) development. The dynamic style guide also known as Living Style Guide.&lt;/p&gt;

&lt;h3&gt;
  
  
  Static Style Guide (SSG)
&lt;/h3&gt;

&lt;p&gt;The static style guide is a file that documents typography, colors/palettes, fonts and many more. They also contain details like spacing info (margin and padding). Nowadays designer prefer to use more sketch-friendly tool like &lt;a href="https://zeplin.io/" rel="noopener noreferrer"&gt;Zeplin&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Living Style Guide (LSG)
&lt;/h3&gt;

&lt;p&gt;Living Style Guide reflects the latest version of the implemented design and includes demos showing interaction and behaviour. Example of the LSG is the extremely popular &lt;a href="https://getbootstrap.com/" rel="noopener noreferrer"&gt;Bootstrap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyghz78gbp5y53ufnem6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyghz78gbp5y53ufnem6k.png" width="800" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All the components placed in the left panel and the right panel contain the view of the component and below it is the code to be used by Developers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A design system isn't just a library of assets with some documentation, it's how you collaborate and communicate between teams and disciplines. &lt;br&gt;
~ Nataly Athree at "cssday"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Before we go to Development life-cycles with SGDD, let's discuss methodology being used in component development. There is plenty of them and my personal choice is &lt;a href="http://bradfrost.com/blog/post/atomic-web-design/" rel="noopener noreferrer"&gt;Atomic Design&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Atomic design is a mental model that allows you to concurrently create both the parts and the whole of a UI design system &lt;br&gt;
~ Brad Frost&lt;/p&gt;

&lt;p&gt;This methodology analyzes the relationships between the different parts of the system and how they interrelate, using chemistry as an analogy. &lt;br&gt;
~ Adriana De La Cuadra (Bitovi)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fluz8q7lyjyddxgm0g2ay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fluz8q7lyjyddxgm0g2ay.png" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Atoms
&lt;/h4&gt;

&lt;p&gt;Atoms are the basic building blocks of matter. Applied to web interfaces, atoms are our HTML tags, such as a form label, an input or a button.&lt;/p&gt;

&lt;h4&gt;
  
  
  Molecules
&lt;/h4&gt;

&lt;p&gt;Molecules are groups of atoms bonded together and are the smallest fundamental units of a compound.&lt;/p&gt;

&lt;h4&gt;
  
  
  Organisms
&lt;/h4&gt;

&lt;p&gt;Organisms are groups of molecules joined together to form a relatively complex, distinct section of an interface.&lt;/p&gt;

&lt;h4&gt;
  
  
  Templates
&lt;/h4&gt;

&lt;p&gt;Templates consist mostly of groups of organisms stitched together to form pages.&lt;/p&gt;

&lt;h4&gt;
  
  
  Pages
&lt;/h4&gt;

&lt;p&gt;Pages are specific instances of templates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc764d7jvbtaqae3dhi44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc764d7jvbtaqae3dhi44.png" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  SGDD with Atomic Design
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fss9hi898riv1qzmhfg0i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fss9hi898riv1qzmhfg0i.png" width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Design Audit
&lt;/h4&gt;

&lt;p&gt;This is when the designer gathered all the requirements and created SSG.&lt;br&gt;
At this stage the LSG serves as a reference when creating designs. Designer would refer to LSG and considering to reusing or extending the atoms components or create the new atom component. &lt;/p&gt;
&lt;h4&gt;
  
  
  2. Component Abstractions
&lt;/h4&gt;

&lt;p&gt;Once the designs are ready to be implemented, designers and developers can use the style guide to discuss how the new features should be broken down into separate components. These is where activity like recomposing the molecules and introducing new component variants happened. &lt;/p&gt;
&lt;h4&gt;
  
  
  3. Publish into Living Style-Guide
&lt;/h4&gt;

&lt;p&gt;This is the process where the component development started. With SGDD in mind the development is all about creating the component and documenting it in LSG. In the end, the LSG becomes both a framework and a playground.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's a framework because it provides the rules that define how elements should look and behave.&lt;/li&gt;
&lt;li&gt;It's a playground as implementer or application developers can interact and straight away see how the component behaves.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  4. Integration
&lt;/h4&gt;

&lt;p&gt;Application developer (library implementor) uses the atoms and molecules components by referring to the LSG for code sample and implementation guide to come up with templates and pages. Its "plug and play" game.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You've heard of plug-and-play. This is plug, unplug and play. It's so simple to use, it's unbelievable. ~ Steve Jobs&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  LSG with Storybook
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://storybook.js.org/" rel="noopener noreferrer"&gt;Storybook&lt;/a&gt; is the most popular UI component development tool for Angular, React and Vue. It helps you develop and design UI components outside your app in an isolated environment.&lt;br&gt;
This article uses Angular as development tool for UI component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z7yad0awv5hrb75irht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z7yad0awv5hrb75irht.png" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basic features of Storybook is Action, Story and Knobs&lt;/p&gt;
&lt;h4&gt;
  
  
  Action
&lt;/h4&gt;

&lt;p&gt;Track any interaction to the component like "click", "mouseover", "double-click" and many more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpubxk1w8cmamu5senb7o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpubxk1w8cmamu5senb7o.png" width="598" height="708"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Story
&lt;/h4&gt;

&lt;p&gt;Implementation code that can be copied by developer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F714igdl2ye972xc5fp7w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F714igdl2ye972xc5fp7w.png" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Knobs
&lt;/h4&gt;

&lt;p&gt;Knobs allow us to edit the component inputs dynamically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvj7z5v801dsb53ncokf4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvj7z5v801dsb53ncokf4.png" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Storybook is a powerful frontend workshop environment tool that allows teams to design, build, and organize UI components (and even full screens!) without getting tripped up over business logic and plumbing ~ Brad Frost&lt;/p&gt;

&lt;p&gt;Storybook has made developing components more streamlined by allowing us to easily include technical documentation within our design system! ~ Taurie Davis&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;
  
  
  Setting up the Storybook
&lt;/h4&gt;

&lt;p&gt;Its recommended to use the &lt;a href="https://storybook.js.org/docs/guides/guide-angular/" rel="noopener noreferrer"&gt;official guide&lt;/a&gt;. If everything going smoothly, the command for creating angular-storybook is just one line command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx -p @storybook/cli sb init --type angular
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;One way to bridge the gap between developers and designers is to bring the SGDD into our workflow. Combining SGDD with Atomic Design helps to accelerate the process of creating modular designs. Having Living Style Guide as single truth documentation boosts development time and team communication. &lt;/p&gt;

</description>
      <category>styleguidedrivendevelopment</category>
      <category>livingstyleguide</category>
      <category>storybook</category>
      <category>angular</category>
    </item>
    <item>
      <title>CSS-in-JS for Angular</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Sun, 21 Jul 2019 16:46:50 +0000</pubDate>
      <link>https://dev.to/aziziyazit/css-in-js-for-angular-1no4</link>
      <guid>https://dev.to/aziziyazit/css-in-js-for-angular-1no4</guid>
      <description>&lt;h2&gt;
  
  
  Why CSS-in-JS?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Primarily, CSS-in-JS boosts my confidence. I can add, change and delete CSS without any unexpected consequences. My changes to the styling of a component will not affect anything else. If I delete a component, I delete its CSS too. No more append-only stylesheets! &lt;br&gt;
~ Max Stoiber&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I am highly recommended developer who have a plan to use CSS-in-JS to read &lt;a href="https://mxstbr.com/thoughts/css-in-js/" rel="noopener noreferrer"&gt;Max Stoiber article&lt;/a&gt;. The points stated in the article is applicable for all frameworks (not only React).&lt;/p&gt;

&lt;h3&gt;
  
  
  Me and CSS-in-JS
&lt;/h3&gt;

&lt;p&gt;To be honest, I am not great at CSS and facing a lots of challenges to design the architecture or organisation for my CSS's. How I survived in my works is by dividing the works into scripting and styling. I do most on the scripting and lets my colleagues in-charge on CSS/SaSS part.&lt;/p&gt;

&lt;p&gt;"i found a light in the dark" when I heard about CSS modules. However I am struggling to integrate the tool with Angular environment and I give up with CSS modules. &lt;/p&gt;

&lt;p&gt;When I moved to new company this year, the company stack is React and Styled-Components. This is when I really "found a light in the dark".&lt;/p&gt;

&lt;h3&gt;
  
  
  Styled-Components
&lt;/h3&gt;

&lt;p&gt;&lt;a href="//https://%20styled-components.com"&gt;styled-components&lt;/a&gt; allows you to write actual CSS code to style your components. It also removes the mapping between components and styles. However styled-components do not have a support for Angular. But don't worry, we can use other CSS-in-JS tool called &lt;b&gt;emotionJS&lt;/b&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  emotionJS
&lt;/h3&gt;

&lt;p&gt;emotionJS is a library designed for writing css styles with JavaScript. It provides powerful and predictable style composition in addition to a great developer experience with features such as source maps, labels, and testing utilities. Both string and object styles are supported. emotionJS is framework agnostic.&lt;/p&gt;

&lt;h3&gt;
  
  
  adding emotionJS into our Angular project
&lt;/h3&gt;

&lt;p&gt;no babel and no webpack config required, its just &lt;b&gt;one single command&lt;/b&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i emotion
~~~

and use it in JavaScript/TypeScript by import its core function &amp;lt;b&amp;gt;css&amp;lt;/b&amp;gt;

~~~javascript
import { css } from "emotion"
~~~

here is sample emotionJS in vanilla JavaScript

![](https://thepracticaldev.s3.amazonaws.com/i/k7r0s1euiu4n19aruucw.png)

### emotionJS with Angular

&amp;gt;It is not until you rhyme with a person that makes you their perfect match, it is when you are satisfied with each others peculiarities, and find jewels in their loopholes.
~ Michael Bassey Johnson

CSS-in-JS is not popular in Angular community and this might be because Angular already have solid styling mechanism and shadow DOM encapsulated your styling to not affecting others while block from side-effects from outside. You can refer this article by [Ashnita Bali](https://ultimatecourses.com/blog/using-ngstyle-in-angular-for-dynamic-styling?fbclid=IwAR3nZH-_CSazBMOprkeXD7uUVtkNpusr0OU7CeJFPWjUzBurwlqDdQs4eJM). However for those who are more comfortable in JavaScript land might like to try styling alternative like CSS-in-JS. 

In this article, we will go thru step by step to applying style based on @Input properties

### step 1 - define component variants (@Input()) 

![](https://thepracticaldev.s3.amazonaws.com/i/njj0iphgd246uh7ntaji.png)

### step 2 - provide default value for all the variants

![](https://thepracticaldev.s3.amazonaws.com/i/o9aabvoznkthhfmrc3vt.png)

### step 3 - listen to the change of the variants and apply styling dynamically

![](https://thepracticaldev.s3.amazonaws.com/i/211jele5qvcerh8a87yr.png)

![](https://thepracticaldev.s3.amazonaws.com/i/okp1iownqu6vv3mlm0d4.png)

- getDynamicStyle method check the variant and assign the styling based on the state of the variant
- its easy to styling your component using component state

here is the [gist](https://gist.github.com/abumuawiyah/6ac9272fc3a5c95e21c915900846042f) for complete script. 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>angular</category>
      <category>cssinjs</category>
      <category>angularstyle</category>
    </item>
    <item>
      <title>Create Page in React</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Tue, 16 Jul 2019 08:32:22 +0000</pubDate>
      <link>https://dev.to/aziziyazit/create-page-in-react-1mj6</link>
      <guid>https://dev.to/aziziyazit/create-page-in-react-1mj6</guid>
      <description>&lt;p&gt;Liquid syntax error: 'raw' tag was never closed&lt;/p&gt;
</description>
      <category>react</category>
      <category>reactpage</category>
      <category>reactarchitecture</category>
    </item>
    <item>
      <title>Create module in React</title>
      <dc:creator>Azizi Yazit</dc:creator>
      <pubDate>Mon, 08 Jul 2019 15:27:49 +0000</pubDate>
      <link>https://dev.to/aziziyazit/create-module-in-react-5gg</link>
      <guid>https://dev.to/aziziyazit/create-module-in-react-5gg</guid>
      <description>&lt;p&gt;There is no module been defined in React and its known that React give full control on the code structure to the developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  module
&lt;/h2&gt;

&lt;p&gt;module can be use to make the code structure better. In React, I like to create a module as a Provider. This is because provider is the one who supply the props, callbacks and data to its consumers (children).&lt;/p&gt;

&lt;h3&gt;
  
  
  module as provider
&lt;/h3&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ModuleAContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createContext&lt;/span&gt;&lt;span class="p"&gt;({})&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;stateA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateC&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ModuleA&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;providerState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useReducer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reducer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;moduleAContextValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;providerState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;reducer&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="na"&gt;STATE_A_CHANGED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stateA&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="na"&gt;STATE_B_CHANGED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stateB&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="na"&gt;STATE_C_CHANGED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stateC&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ModuleAContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;moduleAContextValue&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ChildA&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ChildB&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
   &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ChildC&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;ModuleAContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As provider, moduleA is not only responsible for supplying the data and the callback but also manage events that happened in its children (dispatch).&lt;/p&gt;

&lt;h3&gt;
  
  
  create module children as a consumers
&lt;/h3&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ChildA&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;moduleAContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ModuleAContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;STATE_A_CHANGED&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;onClick=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;moduleAContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stateA&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ChildB&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;moduleAContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ModuleAContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;STATE_B_CHANGED&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;

 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;onClick=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;moduleAContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stateB&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;ChildC&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;moduleAContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ModuleAContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;STATE_C_CHANGED&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;stateC&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;


 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;onClick=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;moduleAContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stateC&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The Consumers is a components that been used by the module. They communicate thru context of the module (ModuleAContext).&lt;/p&gt;

&lt;h3&gt;
  
  
  summary
&lt;/h3&gt;

&lt;p&gt;We have using Context API and use provider-consumers pattern to expose the module props, module state and callbacks to its children (consumers). Adding module in code system helps developer to design complex component as mixture of component that's live under one module.&lt;/p&gt;

&lt;h3&gt;
  
  
  next series
&lt;/h3&gt;

&lt;p&gt;We will talk about "Creating page in React" where page is Container that contains many modules. And we will use custom hooks for modules communication.&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactmodule</category>
      <category>reactarchitecture</category>
    </item>
  </channel>
</rss>
