<?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: Katherine Hebbler</title>
    <description>The latest articles on DEV Community by Katherine Hebbler (@katherineh).</description>
    <link>https://dev.to/katherineh</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%2F1708429%2Fc067466b-5ea4-4ff4-9b83-9abf907909c4.jpg</url>
      <title>DEV Community: Katherine Hebbler</title>
      <link>https://dev.to/katherineh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/katherineh"/>
    <language>en</language>
    <item>
      <title>Gamification in UI/UX</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Mon, 14 Apr 2025 02:49:49 +0000</pubDate>
      <link>https://dev.to/katherineh/gamification-in-uiux-5hc</link>
      <guid>https://dev.to/katherineh/gamification-in-uiux-5hc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Gamification&lt;/strong&gt; is the practice of using game design principles in non-game contexts (like websites or apps) to &lt;strong&gt;engage and influence user behavior&lt;/strong&gt;. It incorporates familiar game-like elements like points, badges, streaks, and rewards to make tasks feel more enjoyable, motivating, or satisfying. &lt;/p&gt;

&lt;p&gt;The goal isn’t to create a game, but to apply the &lt;strong&gt;psychology&lt;/strong&gt; behind games (things like feedback, progress, and small wins) to real-world user interactions. This kind of design can help users stay motivated and achieve goals through &lt;strong&gt;positive reinforcement&lt;/strong&gt;. When done well, gamification can take the experience of completing a task from feeling like an obligation to something that feels rewarding. It encourages users to return not because they have to, but because they &lt;strong&gt;want&lt;/strong&gt; to.&lt;/p&gt;




&lt;h2&gt;
  
  
  Gamification Strategies
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Progress Bars&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;visual feedback&lt;/strong&gt; that shows users progress&lt;/li&gt;
&lt;li&gt;uses our natural desire to complete tasks&lt;/li&gt;
&lt;li&gt;encourages continued interaction by making progress feel &lt;strong&gt;achievable&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;breaks large goals into small milestones&lt;/li&gt;
&lt;li&gt;uses color &amp;amp; animation to make progress satisfying&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When users see progress, they want to finish what they started.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&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;const&lt;/span&gt; &lt;span class="nx"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This calculates the percentage of a task that’s been completed. It divides the number of completed steps by the total steps and multiplies by 100 to convert that fraction into a percentage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streaks&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rewards users for doing something &lt;strong&gt;consistently&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;uses our fear of “breaking the chain”&lt;/li&gt;
&lt;li&gt;forms habits and increases retention&lt;/li&gt;
&lt;li&gt;creates a &lt;strong&gt;psychological commitment&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;encourages users to come back regularly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Apps like Duolingo use badges to keep users coming back every day.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&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;const&lt;/span&gt; &lt;span class="nx"&gt;today&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toDateString&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;lastVisit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lastVisit&lt;/span&gt;&lt;span class="dl"&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;today&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;lastVisit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;incrementStreak&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lastVisit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;today&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This checks if the user visited today by comparing todays date to the last visit stored in local storage. If it’s a new day, it increases the streak count and updates the stored date to today.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Badges&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;visual rewards&lt;/strong&gt; for milestones or accomplishments&lt;/li&gt;
&lt;li&gt;give a sense of &lt;strong&gt;status, progress, and recognition&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;makes users feel seen and encourages them to keep engaging&lt;/li&gt;
&lt;li&gt;encourages goal-setting and completion&lt;/li&gt;
&lt;li&gt;encourages social sharing &amp;amp; competition&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&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;const&lt;/span&gt; &lt;span class="nx"&gt;AchievementBadge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&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;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;badge&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;points&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Badge&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;100 Points!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an AchievementBadge component that shows a badge with a title. It checks if the user has 100 or more points and if they do, it shows a badge that says  “100 Points!”&lt;br&gt;
'&lt;br&gt;
&lt;strong&gt;Levels&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;represents &lt;strong&gt;status&lt;/strong&gt; or &lt;strong&gt;skill progression&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;gives users a clear sense of &lt;strong&gt;advancement&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;encourage continued use by unlocking new challenges, statuses, or rewards&lt;/li&gt;
&lt;li&gt;adds structure to long-term engagement by letting users know where they stand and where they’re headed&lt;/li&gt;
&lt;li&gt;creates a feeling of &lt;strong&gt;mastery&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;uses &lt;strong&gt;familiar gaming logic&lt;/strong&gt; (level up)
breaks down large goals into smaller, achievable steps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xp&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;level&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;level&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;xp&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This checks if the user's xp (experience points) are the required amount to level up. If they have, it increases the level by one and resets the xp to zero to start the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rewards&lt;/strong&gt; give users something &lt;strong&gt;tangible&lt;/strong&gt; or &lt;strong&gt;unlockable&lt;/strong&gt; (like a new feature, a discount, or a prize) and make tasks feel &lt;strong&gt;worth completing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges&lt;/strong&gt; break tasks into &lt;strong&gt;smaller, mini goals&lt;/strong&gt; that feel more &lt;strong&gt;manageable and fun&lt;/strong&gt;. They help keep &lt;strong&gt;momentum&lt;/strong&gt; going.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leaderboards&lt;/strong&gt; add &lt;strong&gt;competition&lt;/strong&gt; by showing users how they rank against other people which can drive motivation, especially in &lt;strong&gt;social apps&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feedback Loops&lt;/strong&gt; give &lt;strong&gt;real-time feedback to user actions&lt;/strong&gt; (like animations or sounds) that reinforce behavior and keep them engaged in the moment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Psychology of Gamification
&lt;/h2&gt;

&lt;p&gt;To understand why gamification works, you have to understand the &lt;strong&gt;psychology&lt;/strong&gt; of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Competence&lt;/strong&gt;&lt;br&gt;
People like feeling like they’re &lt;strong&gt;making progress&lt;/strong&gt; or &lt;strong&gt;improving their skills&lt;/strong&gt; in something. Gamification taps into this through features like progress bars, levels, and achievements. This sense of &lt;strong&gt;mastery&lt;/strong&gt; keeps users engaged because they can see their &lt;strong&gt;growth&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Autonomy&lt;/strong&gt;&lt;br&gt;
Autonomy is about giving users a sense of &lt;strong&gt;control&lt;/strong&gt;. When people feel like they’re making their own choices (like setting goals or choosing rewards) they’re more likely to stay invested. By offering flexibility and personalization, things can feel more empowering and user-friendly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relatedness&lt;/strong&gt;&lt;br&gt;
Humans are social and gamification can strengthen that &lt;strong&gt;social connection&lt;/strong&gt;. Leaderboards, team challenges, badges, or the ability to compete with friends can create a sense of &lt;strong&gt;belonging&lt;/strong&gt;. They make users feel like they’re part of a community even if they're in a digital space.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instant Gratification&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Immediate feedback&lt;/strong&gt; is a powerful psychological tool and sounds, animations, pop-ups, or visual effects that appear right after an action make users feel rewarded in the &lt;strong&gt;moment&lt;/strong&gt;. This kind of positive reinforcement triggers a &lt;strong&gt;dopamine response&lt;/strong&gt; that can help drive interaction and satisfaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variable Rewards&lt;/strong&gt;&lt;br&gt;
Not knowing exactly when or what a reward will be can actually increase engagement. This concept from behavioral psychology is the same principle behind slot machines. Surprise rewards or randomized unlocks can create anticipation and keep users coming back just to see what might happen next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Fogg Behavior Model&lt;/strong&gt;&lt;br&gt;
The Fogg Behavior Model explains that for any behavior to occur, three things must be present at the same time: &lt;strong&gt;motivation&lt;/strong&gt;, &lt;strong&gt;ability&lt;/strong&gt;, and a &lt;strong&gt;trigger&lt;/strong&gt;. In gamification you build motivation through rewards, simplify tasks to increase ability, and use triggers (like a notification, animation, or message) to prompt an action. When all three are utilized then users are much more likely to engage.&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%2Fnfxoyn5p6aizayfhcrsf.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%2Fnfxoyn5p6aizayfhcrsf.png" alt="Fogg" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  TLDR
&lt;/h2&gt;

&lt;p&gt;Gamification makes apps more &lt;strong&gt;engaging&lt;/strong&gt;, &lt;strong&gt;motivating&lt;/strong&gt; and &lt;strong&gt;fun&lt;/strong&gt; by using things like &lt;strong&gt;streaks&lt;/strong&gt;, &lt;strong&gt;badges&lt;/strong&gt; and &lt;strong&gt;progress&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When used correctly it can &lt;strong&gt;improve retention&lt;/strong&gt;, &lt;strong&gt;guide user behavior&lt;/strong&gt; and create a more &lt;strong&gt;satisfying&lt;/strong&gt; experience.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.uxdesigninstitute.com/blog/gamification-in-ux-design/" rel="noopener noreferrer"&gt;Gamification in UX Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://designlab.com/blog/gamification-in-ux-enhancing-engagement-and-interaction" rel="noopener noreferrer"&gt;Gamification in UX: Enhancing Engagement &amp;amp; Interaction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.comarch.com/trade-and-services/loyalty-marketing/blog/use-gamification-progress-bars-to-drive-customer-engagement/" rel="noopener noreferrer"&gt;Gamification: Progress Bars to Drive Customer Engagement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.beeliked.com/blog/psychology-of-gamification%0Ahttps://stackoverflow.com/help/badges" rel="noopener noreferrer"&gt;Psychology of Gamification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://uxplanet.org/how-duolingo-uses-gamification-to-make-learning-fun-fb6b36ea72f0" rel="noopener noreferrer"&gt;How Duolingo Uses Gamification to Make Learning Fun&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://sa-liberty.medium.com/the-31-core-gamification-techniques-part-1-progress-achievement-mechanics-d81229732f07" rel="noopener noreferrer"&gt;31 Core Gamification Techniques&lt;/a&gt;
&lt;a href="https://userpilot.com/blog/gamification-example-saas/" rel="noopener noreferrer"&gt;Gamification Example Saas&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://x.com/felixleezd/status/1651245762783899648?s=46&amp;amp;t=eon7xHiLCrpzcQMiwpsiag" rel="noopener noreferrer"&gt;X Duolingo Thread&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://behaviormodel.org/" rel="noopener noreferrer"&gt;Fogg Behavior Model&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Dark Patterns in UX Design</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Mon, 31 Mar 2025 01:47:19 +0000</pubDate>
      <link>https://dev.to/katherineh/dark-patterns-in-ux-design-3bfm</link>
      <guid>https://dev.to/katherineh/dark-patterns-in-ux-design-3bfm</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;What are Dark Patterns?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Dark patterns&lt;/strong&gt; are choices made by designers that are meant to trick, pressure, or manipulate users into making decisions that benefit the company, usually at the expense of the user.&lt;/p&gt;

&lt;p&gt;The term dark pattern was first used by UX designer &lt;strong&gt;Harry Brignull&lt;/strong&gt; with the registration of &lt;a href="https://www.deceptive.design/" rel="noopener noreferrer"&gt;darkpatterns.org&lt;/a&gt; to document patterns that rely on psychological manipulation instead of honest design.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Common Types of Dark Patterns&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;❓&lt;strong&gt;Trick Questions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;phrased in a confusing way to make users accidentally choose “yes”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: "Uncheck this box if you don’t want to receive emails... unless you actually do, in which case re-check it."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔄&lt;strong&gt;Bait and Switch&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the user means to do one thing, but something totally different happens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;: In 2016, Microsoft &lt;a href="https://think.design/blog/responsible-design-part-6-of-14-bait-and-switch/" rel="noopener noreferrer"&gt;tried&lt;/a&gt; to get users to upgrade to Windows 10 by changing the meaning of the red “X” in a pop-up. Instead of closing the window like they thought, clicking the X confirmed the upgrade.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔀&lt;strong&gt;Misdirection&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;using &lt;a href="https://thedecisionlab.com/reference-guide/design/visual-hierarchy" rel="noopener noreferrer"&gt;visual hierarchy&lt;/a&gt; to take attention away from what the company doesn’t want you to notice&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;: A giant colorful “Yes” button and a tiny grayed-out “No thanks” link in fine print.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💰&lt;strong&gt;Hidden Costs&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;only shown at the last step of checkout&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;: Unexpected fees like shipping, taxes, service fees&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⏳&lt;strong&gt;Forced Continuity&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;free trial ends → surprise charge&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Adobe's annual plans involve early termination fees (ETFs) if you cancel after the initial 14-day period. According to Adobe's &lt;a href="https://helpx.adobe.com/manage-account/using/creative-cloud-subscription-terms.html?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Subscription Terms&lt;/a&gt; "If you cancel within 14 days of your initial order, you’ll be fully refunded. Should you cancel after 14 days, you’ll be charged a lump sum amount of 50% of your remaining contract obligation..." &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧱&lt;strong&gt;Disguised Ads&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;ads that look like regular content or navigation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: Softpedia placed &lt;a href="https://old.deceptive.design/disguised_ads/" rel="noopener noreferrer"&gt;ads&lt;/a&gt; with fake “Download” buttons that looked almost exactly like the real ones. Users accidentally clicked the ad, thinking it was the actual download link.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;😕&lt;strong&gt;Confirmshaming&lt;/strong&gt; - making the user feel guilty for opting out&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;:
✅ “Yes, I want to save money.”
❌ “No thanks, I like wasting money.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🪤&lt;strong&gt;The Roach Motel&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;looks easy to get into, but hard to get out of&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;: Subscribing to a service takes 1 click. Cancelling requires a phone call or an email.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔓&lt;strong&gt;Privacy Zuckering&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tricking users into sharing more personal data than they realize &lt;/li&gt;
&lt;li&gt;Named after Mark Zuckerberg, this pattern can also make it harder for users to find and change their privacy settings. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;: A website may make users navigate through multiple pages or menus to get to their privacy settings, making it less likely that they would&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🛒&lt;strong&gt;Sneak into Basket&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an extra product or service is automatically added to the cart unless you notice and remove it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt;: In 2015 SportsDirect.com was &lt;a href="https://www.deceptive.design/types/sneaking" rel="noopener noreferrer"&gt;caught&lt;/a&gt; automatically adding a £1 magazine subscription to carts during checkout. Most people didn’t notice and had to remove it manually to avoid the charge.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Legality&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Many types of deceptive patterns are illegal in the United States and Europe, and companies that use them have been in legal cases where they faced large fines and penalties.&lt;/p&gt;

&lt;p&gt;In 2022, the company behind Fortnite &lt;strong&gt;Epic Games&lt;/strong&gt; paid $245 million to settle &lt;a href="https://www.ftc.gov/news-events/news/press-releases/2022/12/fortnite-video-game-maker-epic-games-pay-more-half-billion-dollars-over-ftc-allegations" rel="noopener noreferrer"&gt;charges&lt;/a&gt; from the U.S. Federal Trade Commission (FTC) for using "dark patterns to trick users into making purchases" in their payment system such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Misdirection&lt;/strong&gt; - confusing button layouts that could lead to accidental purchases with one click&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Roach Motel&lt;/strong&gt; - difficulty cancelling or reversing charges&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sneak Into Basket/Forced Action&lt;/strong&gt; - ability to make unauthorized charges without parental consent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 2023, &lt;strong&gt;TikTok&lt;/strong&gt; was fined €345 million by the Irish Data Protection Commission (DPC) for &lt;a href="https://www.edpb.europa.eu/system/files/2023-09/final_decision_tiktok_in-21-9-1_-_redacted_8_september_2023.pdf" rel="noopener noreferrer"&gt;violations&lt;/a&gt; of &lt;a href="https://gdpr-info.eu/art-5-gdpr/" rel="noopener noreferrer"&gt;Art. 5 GDPR&lt;/a&gt; relating to the processing of personal data. Their design choices were found to be manipulative and misleading, especially for children by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Preselection&lt;/strong&gt; - setting profiles to "public" by default, even for minors&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual Interference&lt;/strong&gt; - highlighting certain buttons like "Post Now" in bold colors to draw attention but making privacy options less noticeable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forced Action&lt;/strong&gt; - making it harder to opt out of sharing data&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why to Aviod Dark Patterns&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Unethical&lt;/strong&gt; – they exploit the user's trust and take advantage of them&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Breaks Trust&lt;/strong&gt; – users who feel tricked can be less likely to return&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Legal Risk&lt;/strong&gt; – regulators are now cracking down and the consequences can be expensive&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bad UX&lt;/strong&gt; – manipulative design could have short-term benefits for the company but can lead to poor long-term user experience&lt;/p&gt;

&lt;p&gt;⭐ Good design respects the user’s time, intent, and intelligence.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Sources&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.deceptive.design/" rel="noopener noreferrer"&gt;Deceptive Design - Harry Brignull&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://dl.acm.org/doi/10.1145/3359183" rel="noopener noreferrer"&gt;Dark Patterns at Scale: Findings from a Crawl of 11K Shopping Websites&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.osano.com/articles/dark-pattern-examples" rel="noopener noreferrer"&gt;9 Dark Pattern Examples to Look Out For&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Dark_pattern" rel="noopener noreferrer"&gt;Dark Patterns - Wikipedia&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.nngroup.com/articles/deceptive-patterns/" rel="noopener noreferrer"&gt;Deceptive Patterns in UX: How to Recognize and Avoid Them&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.vox.com/recode/22351108/dark-patterns-ui-web-design-privacy" rel="noopener noreferrer"&gt;How Dark Patterns in Web Design Trick You into Saying Yes&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://vickiortiz.medium.com/welcome-to-the-roach-motel-86b8cd424ea7" rel="noopener noreferrer"&gt;Welcome to the Roach Motel&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.ftc.gov/news-events/news/press-releases/2022/12/fortnite-video-game-maker-epic-games-pay-more-half-billion-dollars-over-ftc-allegations" rel="noopener noreferrer"&gt;FTC/Fortnite Press Release&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://thedecisionlab.com/reference-guide/design/visual-hierarchy" rel="noopener noreferrer"&gt;Visual Hierarchy&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://old.deceptive.design/disguised_ads/" rel="noopener noreferrer"&gt;Disguised Ads&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.interaction-design.org/literature/topics/sneaking-into-basket?srsltid=AfmBOornPPKfYuo2fTg6wspdiAIHezuBytqrPPmZwUF-R3uRK_YKJMDO" rel="noopener noreferrer"&gt;Sneaking Into Basket&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://emojipedia.org/" rel="noopener noreferrer"&gt;Emojipedia&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Tailwind CSS: A Utility-First Approach to Styling</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Mon, 17 Mar 2025 00:08:54 +0000</pubDate>
      <link>https://dev.to/katherineh/tailwind-css-a-utility-first-approach-to-styling-1ljf</link>
      <guid>https://dev.to/katherineh/tailwind-css-a-utility-first-approach-to-styling-1ljf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Tailwind CSS&lt;/strong&gt; is a "utility-first CSS framework for rapidly building modern websites without ever leaving your HTML". &lt;/p&gt;

&lt;p&gt;Unlike traditional frameworks like Bootstrap or Bulma that come with pre-built components, Tailwind gives you a set of &lt;strong&gt;low-level utility classes&lt;/strong&gt; to design your website however you want without writing tons of custom CSS from scratch.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why Use Tailwind CSS?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Utility-First Approach&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of writing custom CSS for each of your components, Tailwind provides &lt;a href="https://johnpolacek.github.io/the-case-for-atomic-css/" rel="noopener noreferrer"&gt;atomic utility classes&lt;/a&gt; that handle all sorts of things like padding, margins, colors, flexbox, and grids.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="err"&gt;"&lt;/span&gt;&lt;span class="na"&gt;bg-blue-500&lt;/span&gt; &lt;span class="na"&gt;text-white&lt;/span&gt; &lt;span class="na"&gt;px-4&lt;/span&gt; &lt;span class="na"&gt;py-2&lt;/span&gt; &lt;span class="na"&gt;rounded-md&lt;/span&gt; &lt;span class="na"&gt;shadow-md&lt;/span&gt;
 &lt;span class="na"&gt;hover&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="na"&gt;bg-blue-600&lt;/span&gt;&lt;span class="err"&gt;"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  Click Here!
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This single string replaces a lot of custom CSS and makes everything consistent across the UI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Rapid Development&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With predefined &lt;a href="https://tailwindcss.com/docs/styling-with-utility-classes" rel="noopener noreferrer"&gt;classes&lt;/a&gt;, you don’t need to constantly switch between HTML and CSS files and can build your layouts without writing a single line of CSS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Customizable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tailwind provides a &lt;a href="https://v2.tailwindcss.com/docs/configuration" rel="noopener noreferrer"&gt;configuration&lt;/a&gt; file (&lt;code&gt;tailwind.config.js&lt;/code&gt;) where you can define your styles, themes, and &lt;a href="https://tailwindcss.com/docs/responsive-design" rel="noopener noreferrer"&gt;responsive breakpoints&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#1DA1F2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;secondary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#14171A&lt;/span&gt;&lt;span class="dl"&gt;'&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="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;This makes it easy to keep a &lt;strong&gt;consistent design&lt;/strong&gt; across your project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Responsive Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tailwind uses a &lt;strong&gt;mobile-first&lt;/strong&gt; approach with simple &lt;a href="https://tailwindcss.com/docs/responsive-design" rel="noopener noreferrer"&gt;responsive prefixes&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&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;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"p-4 md:p-8 lg:p-12"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  Responsive!
&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;p-4&lt;/code&gt; (default padding)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;md:p-8&lt;/code&gt; (medium screens)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lg:p-12&lt;/code&gt; (large screens)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tailwind uses &lt;a href="https://v2.tailwindcss.com/docs/just-in-time-mode" rel="noopener noreferrer"&gt;JIT (Just-In-Time) mode&lt;/a&gt;, which means that only the classes you used are included in the final CSS file. This helps your site load faster, keeping styles &lt;strong&gt;lightweight&lt;/strong&gt; and &lt;a href="https://v3.tailwindcss.com/docs/optimizing-for-production" rel="noopener noreferrer"&gt;optimized for production&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;How to Use Tailwind&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install Tailwind via npm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run this command to install Tailwind in your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt; &lt;span class="nx"&gt;vite&lt;/span&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;latest&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;your&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; --template react
cd &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;your&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Install Tailwind CSS &amp;amp; Dependencies&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;D&lt;/span&gt; &lt;span class="nx"&gt;tailwindcss&lt;/span&gt; &lt;span class="nx"&gt;postcss&lt;/span&gt; &lt;span class="nx"&gt;autoprefixer&lt;/span&gt;
&lt;span class="nx"&gt;npx&lt;/span&gt; &lt;span class="nx"&gt;tailwindcss&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates two files:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;tailwind.config.js&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;postcss.config.js&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Configure Tailwind&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modify the &lt;code&gt;tailwind.config.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&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;./src/**/*.{js,jsx,ts,tsx}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;extend&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="na"&gt;plugins&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Include Tailwind in Your CSS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add Tailwind to your main CSS file (ex. &lt;code&gt;styles.css&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;tailwind&lt;/span&gt; &lt;span class="nx"&gt;base&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;tailwind&lt;/span&gt; &lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;tailwind&lt;/span&gt; &lt;span class="nx"&gt;utilities&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Start Using Tailwind Classes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now you can apply Tailwind classes in your HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-3xl font-bold text-center text-blue-500"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
Hello, World!
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://tailwindcss.com/docs/installation/using-vite" rel="noopener noreferrer"&gt;Official Tailwind Installation Guide&lt;/a&gt; - step-by-step instructions for installing Tailwind&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Tools &amp;amp; Resources&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt; - official documentation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://play.tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind Playground&lt;/a&gt; - try Tailwind in your browser&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://heroicons.com/" rel="noopener noreferrer"&gt;Heroicons&lt;/a&gt; - free icons from Tailwind's creators&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://tailwindcss.com/plus" rel="noopener noreferrer"&gt;Tailwind UI&lt;/a&gt; - paid premium components for Tailwind&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://flowbite.com/" rel="noopener noreferrer"&gt;Flowbite&lt;/a&gt; - open-source Tailwind component library&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://daisyui.com/" rel="noopener noreferrer"&gt;DaisyUI&lt;/a&gt; - prebuilt themes &amp;amp; components for Tailwind&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/aniftyco/awesome-tailwindcss" rel="noopener noreferrer"&gt;Awesome Tailwind CSS &lt;/a&gt; - list of Tailwind resources, tools, &amp;amp; projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://nerdcave.com/tailwind-cheat-sheet" rel="noopener noreferrer"&gt;Tailwind Cheat Sheet&lt;/a&gt; - quickly lookup Tailwind classes&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Tailwind CSS makes styling websites &lt;strong&gt;simpler and more flexible&lt;/strong&gt; by using utility classes instead of pre-built components. Unlike traditional frameworks it gives you &lt;strong&gt;full control&lt;/strong&gt; over your design without having to write a lot of unnecessary CSS.&lt;/p&gt;

&lt;p&gt;It has a bit of a learning curve but once you get the hang of it, it can make development &lt;strong&gt;faster, cleaner, and more efficient&lt;/strong&gt;. Tailwind helps you build &lt;strong&gt;modern, responsive, and easily maintainable&lt;/strong&gt; applications, so if you’re looking for a &lt;strong&gt;lightweight&lt;/strong&gt; and &lt;strong&gt;scalable&lt;/strong&gt; approach to styling, Tailwind is a great choice.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Sources&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/what-is-the-utility-first-approach-in-tailwind-css/#" rel="noopener noreferrer"&gt;What is the Utility-First Approach in Tailwind CSS ?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://johnpolacek.github.io/the-case-for-atomic-css/" rel="noopener noreferrer"&gt;The Case for Atomic / Utility-First CSS&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=dFgzHOX84xQ" rel="noopener noreferrer"&gt;Tailwind Crash Course | Project From Scratch&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://nerdcave.com/tailwind-cheat-sheet" rel="noopener noreferrer"&gt;Tailwind Cheat Sheet&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kombai.com/tailwind/tailwind-react-native-installation-and-usage/" rel="noopener noreferrer"&gt;How to use Tailwind CSS with React Native&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tailwind&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://v2.tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind Docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://v2.tailwindcss.com/docs/just-in-time-mode" rel="noopener noreferrer"&gt;Just-in-Time Mode&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://tailwindcss.com/docs/theme" rel="noopener noreferrer"&gt;Theme variables&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://v2.tailwindcss.com/docs/configuration" rel="noopener noreferrer"&gt;Configuration&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://v3.tailwindcss.com/docs/optimizing-for-production" rel="noopener noreferrer"&gt;Optimizing for Production&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://tailwindcss.com/docs/installation/using-vite" rel="noopener noreferrer"&gt;Official Tailwind Installation Guide&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>tailwindcss</category>
      <category>beginners</category>
      <category>html</category>
      <category>frontend</category>
    </item>
    <item>
      <title>UX/UI Design: A Beginner's Guide</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Mon, 03 Feb 2025 01:23:35 +0000</pubDate>
      <link>https://dev.to/katherineh/uxui-design-1mon</link>
      <guid>https://dev.to/katherineh/uxui-design-1mon</guid>
      <description>&lt;p&gt;When building a product like a website or an app, two important aspects that should always be considered are the &lt;strong&gt;User Interface&lt;/strong&gt; (UI) and &lt;strong&gt;User Experience&lt;/strong&gt; (UX). These design elements don’t just control how the product looks, but also how easily and naturally a user can navigate and interact with it.&lt;/p&gt;

&lt;p&gt;While closely related, the UI and UX both have their own important role in shaping a user’s experience. &lt;strong&gt;UI&lt;/strong&gt; focuses on the visual and interactive elements, and &lt;strong&gt;UX&lt;/strong&gt; focuses on the usability and functionality of the product. When used together effectively, they can help create designs that are both visually appealing and user-friendly.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;User Interface (UI)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Every app and every website has a &lt;strong&gt;user interface&lt;/strong&gt;, which is the part of the product that the user sees and interacts with.  User Interface design focuses on how a product looks and responds to the user’s actions. It includes things like buttons, icons, color, and fonts, all working together to make the user’s experience easy to use and visually appealing.&lt;/p&gt;

&lt;p&gt;UI basically has two main jobs: &lt;strong&gt;accepting a user’s input and showing them the results&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input&lt;/strong&gt; happens when a user interacts with the product by doing something like clicking a button, typing in text, or navigating a menu. &lt;/li&gt;
&lt;li&gt;The UI responds by &lt;strong&gt;showing the results&lt;/strong&gt; of that input by giving the user visual feedback (like highlighting the button or showing a progress bar), letting them know that their input has been submitted and registered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;History of UI&lt;/strong&gt;&lt;br&gt;
Early computers had simple user interfaces, relying on basic buttons and &lt;a href="https://www.ibm.com/history/punched-card" rel="noopener noreferrer"&gt;punched cards&lt;/a&gt; for input. The introduction of the &lt;a href="https://www.geeksforgeeks.org/what-is-command-line-interface-cli/" rel="noopener noreferrer"&gt;Command Line Interface&lt;/a&gt;(CLI) let users work with computers by typing commands, letting them put in the instructions directly, instead of being limited to pre–punched, fixed inputs.&lt;/p&gt;

&lt;p&gt;Later, &lt;a href="https://www.bbc.co.uk/bitesize/guides/z4b3pg8/revision/4" rel="noopener noreferrer"&gt;Menu Driven Interfaces&lt;/a&gt;  gave a more structured way to use software, which eventually led to the creation of the &lt;a href="https://www.geeksforgeeks.org/gui-full-form/" rel="noopener noreferrer"&gt;Graphical User Interface&lt;/a&gt; (GUI) by Xerox PARC and was improved by Apple and Microsoft. The GUI introduced visual elements like windows, icons, and buttons, making computers more accessible and user-friendly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Elements of UI Design
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;💻&lt;strong&gt;Layout &amp;amp; Structure&lt;/strong&gt; – organizing content in a clear way&lt;/li&gt;
&lt;li&gt;🎨&lt;strong&gt;Typography &amp;amp; Colors&lt;/strong&gt; – picking readable fonts and colors for usability&lt;/li&gt;
&lt;li&gt;📲&lt;strong&gt;Buttons &amp;amp; Icons&lt;/strong&gt; – making interactive elements easy to use&lt;/li&gt;
&lt;li&gt;‼️&lt;strong&gt;Feedback &amp;amp; Responsiveness&lt;/strong&gt; – acknowledging actions with animations, highlights, or messages&lt;/li&gt;
&lt;li&gt;📑&lt;strong&gt;Consistency&lt;/strong&gt; – keeping design elements the same in the product&lt;/li&gt;
&lt;li&gt;👩🏽‍🦯‍➡️&lt;strong&gt;Accessibility&lt;/strong&gt; – designing for &lt;em&gt;all users&lt;/em&gt;, including people with disabilities (ex. color contrast, text size, and navigation aids)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;User Experience (UX)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;User Experience (UX)&lt;/strong&gt; design focuses on how a product works, &lt;em&gt;feels&lt;/em&gt;, and how easy it is to use. UX design lets a user complete tasks easily, efficiently, and without frustration.&lt;/p&gt;

&lt;p&gt;Good UX design makes a product feel natural and &lt;a href="https://ux.princeton.edu/learn-ux/blog/intuitive-interface" rel="noopener noreferrer"&gt;intuitive&lt;/a&gt;, whether the user is browsing a website, using an app, or using software like word processors or design tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  UX Design Process
&lt;/h2&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%2Fc5dk3myae7oc8dyob0ti.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%2Fc5dk3myae7oc8dyob0ti.png" alt="UX Design Process" width="660" height="300"&gt;&lt;/a&gt;&lt;br&gt;
Image Source: GeeksforGeeks – &lt;a href="https://www.geeksforgeeks.org/ux-design-process/" rel="noopener noreferrer"&gt;UX Design Process&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;💡 &lt;strong&gt;Problem/Product Definition&lt;/strong&gt; – defining what the product will do, who its audience is, and what problems it needs to solve&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🗺️ &lt;strong&gt;Roadmap to Get Started&lt;/strong&gt; – planning the project by creating timelines, setting goals, and outlining the UX strategy. Also, creating &lt;a href="https://research.ijcaonline.org/volume108/number3/pxc3900179.pdf" rel="noopener noreferrer"&gt;user profiles&lt;/a&gt; and &lt;a href="https://blog.hubspot.com/marketing/buyer-persona-definition-under-100-sr#sm.0001xrwvs2g4rebbxml1ttrf83fs3" rel="noopener noreferrer"&gt;personas&lt;/a&gt; to identify the right audience for research&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🔍 &lt;strong&gt;Research&lt;/strong&gt; – conducting research on users through interviews, surveys, and competitor analysis to get insight about their behaviors, preferences, and &lt;a href="https://www.nngroup.com/articles/pain-points/" rel="noopener noreferrer"&gt;pain points&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;📑 &lt;strong&gt;Analyze&lt;/strong&gt; – interpreting the research data to refine personas and create &lt;a href="https://www.geeksforgeeks.org/customer-journey-map/" rel="noopener noreferrer"&gt;journey maps&lt;/a&gt;, &amp;amp; &lt;a href="https://www.geeksforgeeks.org/what-is-a-problem-statement-in-ux/" rel="noopener noreferrer"&gt;problem statements&lt;/a&gt; to help designers understand how the users will interact with the product&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🎨 &lt;strong&gt;Design&lt;/strong&gt; – creating &lt;a href="https://www.geeksforgeeks.org/wireframe-in-ux-design-a-beginners-guide/" rel="noopener noreferrer"&gt;wireframes&lt;/a&gt;, &lt;a href="https://www.geeksforgeeks.org/prototyping-in-ux-design-benefits-types/" rel="noopener noreferrer"&gt;prototypes&lt;/a&gt;, and layouts based on the research&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;✅ &lt;strong&gt;Validation&lt;/strong&gt; – testing prototypes with users to improve the design before implementation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🏁 &lt;strong&gt;Handover&lt;/strong&gt; – delivering the finished UX design to the dev team for &lt;a href="https://formationmedia.co.uk/blog/ux-101-development-and-implementation/" rel="noopener noreferrer"&gt;implementation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tools Used in UX Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UX designers use tools to create wireframes, prototypes, and mockups. Two of the most popular tools used are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.figma.com/" rel="noopener noreferrer"&gt;Figma&lt;/a&gt;&lt;/strong&gt; – a cloud-based tool that lets teams collaborate in real time, making it easier for remote projects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://helpx.adobe.com/xd/user-guide.html" rel="noopener noreferrer"&gt;Adobe XD&lt;/a&gt;&lt;/strong&gt; – a vector-based tool used to design and prototype interactive experiences for websites, apps, and software&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These tools help designers visualize ideas, test interactions, and refine designs before development starts.&lt;/p&gt;




&lt;p&gt;Good UI/UX is important for a product’s success. A clean and easy-to-use design keeps a user engaged, improves their satisfaction, and encourages them to return and use the product again. On the other hand, bad UI/UX can frustrate users, drive them away, and potentially hurt a business's performance. Whether you're building a website, app, or software, focusing on good UI/UX through research, testing, and &lt;strong&gt;thoughtful design&lt;/strong&gt; creates a smoother and more enjoyable experience for the user.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/User_interface" rel="noopener noreferrer"&gt;User Interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/responsive-web-design/?ref=shm" rel="noopener noreferrer"&gt;Responsive Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/user-interface-ui/#" rel="noopener noreferrer"&gt;User Interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/user-experience-or-ux-design/?ref=shm" rel="noopener noreferrer"&gt;User Experience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/what-is-command-line-interface-cli/" rel="noopener noreferrer"&gt;Command Line Interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ibm.com/history/punched-card" rel="noopener noreferrer"&gt;Punched Card&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://alan.app/blog/types-of-user-interface/" rel="noopener noreferrer"&gt;Types of User Interfaces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ux.princeton.edu/learn-ux/blog/intuitive-interface" rel="noopener noreferrer"&gt;Intuitive Interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nngroup.com/articles/pain-points/" rel="noopener noreferrer"&gt;Pain Points&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/wireframe-in-ux-design-a-beginners-guide/" rel="noopener noreferrer"&gt;Wireframes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/prototyping-in-ux-design-benefits-types/" rel="noopener noreferrer"&gt;Prototypes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://research.ijcaonline.org/volume108/number3/pxc3900179.pdf" rel="noopener noreferrer"&gt;User Profiles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.hubspot.com/marketing/buyer-persona-definition-under-100-sr#sm.0001xrwvs2g4rebbxml1ttrf83fs3" rel="noopener noreferrer"&gt;Personas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://formationmedia.co.uk/blog/ux-101-development-and-implementation/" rel="noopener noreferrer"&gt;Implementation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ux</category>
      <category>ui</category>
      <category>design</category>
    </item>
    <item>
      <title>CSS Libraries: 7 Popular Options</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Mon, 27 Jan 2025 00:22:22 +0000</pubDate>
      <link>https://dev.to/katherineh/css-5pl</link>
      <guid>https://dev.to/katherineh/css-5pl</guid>
      <description>&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS" rel="noopener noreferrer"&gt;Cascading Style Sheets&lt;/a&gt;, or &lt;strong&gt;CSS&lt;/strong&gt;, is a stylesheet language  that describes how HTML elements should look on our screen. With it, we can control the layout, colors, fonts, and more.&lt;/p&gt;

&lt;p&gt;Instead of writing your own CSS, you can use prebuilt CSS &lt;strong&gt;libraries&lt;/strong&gt; or frameworks to help you and keep your code organized. Below are some of the most popular options:&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%2Fjcj8fxetlmgznwslbxn8.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%2Fjcj8fxetlmgznwslbxn8.png" alt="Bootstrap" width="121" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bootstrap
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://getbootstrap.com/" rel="noopener noreferrer"&gt;Bootstrap&lt;/a&gt; is a popular CSS framework that was developed by Twitter in 2011. It has HTML and CSS design templates for things like typography, forms, buttons, tables, navigation and modals, as well as a number of premade &lt;a href="https://themes.getbootstrap.com/" rel="noopener noreferrer"&gt;themes&lt;/a&gt; built or reviewed by Bootstrap's creators. It also has predefined &lt;a href="https://www.w3schools.com/bootstrap/bootstrap_ref_all_classes.asp" rel="noopener noreferrer"&gt;classes&lt;/a&gt; for easy layout options.&lt;/p&gt;

&lt;p&gt;Bootstrap has a mobile-first fluid grid system that scales up to 12 columns as the device or viewport size increases, making it easy to build &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag" rel="noopener noreferrer"&gt;responsive&lt;/a&gt; pages that look good on any device.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://getbootstrap.com/docs/4.1/getting-started/introduction/" rel="noopener noreferrer"&gt;Bootstrap Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&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%2Flenn3m9wh2z6qv1t964p.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%2Flenn3m9wh2z6qv1t964p.PNG" alt="Bulma" width="251" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bulma
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://bulma.io/" rel="noopener noreferrer"&gt;Bulma&lt;/a&gt; is another popular framework, mainly because it's easy to learn and use, and also because you only need a CSS file- no JavaScript.&lt;/p&gt;

&lt;p&gt;You can use one of Bulma's prebuilt &lt;a href="https://bulma.io/documentation/start/alternative-versions/" rel="noopener noreferrer"&gt;alternative versions&lt;/a&gt;, and it even comes with an automatic &lt;a href="https://bulma.io/documentation/features/dark-mode/" rel="noopener noreferrer"&gt;dark mode&lt;/a&gt; feature.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://bulma.io/documentation/" rel="noopener noreferrer"&gt;Bulma Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&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%2F2p084ye511whb87lr3ts.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%2F2p084ye511whb87lr3ts.png" alt="Pure" width="244" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pure CSS
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pure-css.github.io/" rel="noopener noreferrer"&gt;Pure&lt;/a&gt; is a set of small, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag" rel="noopener noreferrer"&gt;responsive&lt;/a&gt; CSS modules developed by Yahoo, built on top of &lt;a href="https://necolas.github.io/normalize.css/" rel="noopener noreferrer"&gt;Normalize CSS&lt;/a&gt;, with a focus on being "CSS with a minimal footprint" and keeping the file size as small as possible. &lt;/p&gt;

&lt;p&gt;It's similar to Bootstrap, but Pure is better for small projects or one's that emphasize speed. Pure has a very minimalist style and also comes with some simple &lt;a href="https://pure-css.github.io/layouts/" rel="noopener noreferrer"&gt;layouts&lt;/a&gt;. Pure was created with mobile in mind, meaning it's a good choice for responsive design.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://pure-css.github.io/start/" rel="noopener noreferrer"&gt;Pure CSS Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&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%2For0wpa3833nfwkhet1eh.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%2For0wpa3833nfwkhet1eh.PNG" alt="Animate" width="329" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Animate.css
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://animate.style/" rel="noopener noreferrer"&gt;Animate&lt;/a&gt; is a library of "ready-to-use, cross-browser animations for use in your web projects [&lt;a href="https://animate.style/#documentation" rel="noopener noreferrer"&gt;.&lt;/a&gt;]". It comes with easy-to-use &lt;a href="https://animate.style/#utilities" rel="noopener noreferrer"&gt;utility classes&lt;/a&gt; for delay, speed, and repetition.&lt;/p&gt;

&lt;p&gt;After you install Animate.css, you just add the class &lt;code&gt;animate__animated&lt;/code&gt; to an element, and then the &lt;a href="https://animate.style/#attention_seekers" rel="noopener noreferrer"&gt;animation names&lt;/a&gt;. Their &lt;a href="https://animate.style/" rel="noopener noreferrer"&gt;website&lt;/a&gt; even has a fun feature that let's you test them out by clicking on the animation name in the side bar and it will apply that animation to the Animate.css logo on the page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://animate.style/" rel="noopener noreferrer"&gt;Animate CSS Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&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%2Fbsrukuwqw58i59x5erok.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%2Fbsrukuwqw58i59x5erok.PNG" alt="Tailwind" width="335" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tailwind
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind&lt;/a&gt; is a modern, &lt;a href="https://tailwindcss.com/docs/styling-with-utility-classes" rel="noopener noreferrer"&gt;utility-first&lt;/a&gt; CSS framework designed to give you complete control over how your site looks. &lt;/p&gt;

&lt;p&gt;Tailwind doesn't have predefined classes for elements like buttons or tables; instead, it provides low-level &lt;a href="https://tailwindcss.com/docs/styling-with-utility-classes" rel="noopener noreferrer"&gt;utility classes&lt;/a&gt; that let you build custom designs without writing any custom CSS. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://v2.tailwindcss.com/docs" rel="noopener noreferrer"&gt;Tailwind Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&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%2F2kbc2r6e9wt9fbi6ss06.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%2F2kbc2r6e9wt9fbi6ss06.PNG" alt="Material" width="253" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Material UI
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://mui.com/" rel="noopener noreferrer"&gt;MUI (Material UI)&lt;/a&gt; is a React component library that implements Google's &lt;a href="https://m3.material.io/" rel="noopener noreferrer"&gt;Material Design&lt;/a&gt;. It comes with premade &lt;a href="https://mui.com/material-ui/all-components/?srsltid=AfmBOor8pRpVPYOr_pcqFRe_vSSUAG1mPSWDE14WuM_LpiK7dHfN3cuy" rel="noopener noreferrer"&gt;components&lt;/a&gt; (&lt;a href="https://mui.com/material-ui/react-button/" rel="noopener noreferrer"&gt;buttons&lt;/a&gt;, &lt;a href="https://mui.com/material-ui/react-slider/" rel="noopener noreferrer"&gt;sliders&lt;/a&gt;, etc.) that follow Google's Material Design guidelines.&lt;/p&gt;

&lt;p&gt;It even has free Material UI &lt;a href="https://mui.com/material-ui/getting-started/templates/" rel="noopener noreferrer"&gt;templates&lt;/a&gt;, including a marketing page, a checkout flow, sign-in and sign-up pages, and a blog.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://mui.com/material-ui/getting-started/" rel="noopener noreferrer"&gt;Material UI Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&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%2F5b0tudcublfdj1tb219j.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%2F5b0tudcublfdj1tb219j.PNG" alt="Pico" width="163" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pico CSS
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://picocss.com/" rel="noopener noreferrer"&gt;Pico&lt;/a&gt; is a minimalist, lightweight CSS library for semantic HTML (&lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;) with a focus on making every HTML responsive and elegant by default. &lt;/p&gt;

&lt;p&gt;It's small in size, styling your HTML tags using less than 10 &lt;code&gt;.classes&lt;/code&gt;. It also comes with a &lt;a href="https://picocss.com/docs/classless" rel="noopener noreferrer"&gt;classless &lt;/a&gt;version.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📋&lt;a href="https://picocss.com/docs" rel="noopener noreferrer"&gt;Pico CSS Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Sources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://getbootstrap.com/docs/4.1/getting-started/introduction/" rel="noopener noreferrer"&gt;Bootstrap Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://bulma.io/documentation/" rel="noopener noreferrer"&gt;Bulma Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://pure-css.github.io/start/" rel="noopener noreferrer"&gt;Pure CSS Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://animate.style/" rel="noopener noreferrer"&gt;Animate CSS Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://v2.tailwindcss.com/docs" rel="noopener noreferrer"&gt;Tailwind Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://mui.com/material-ui/getting-started/" rel="noopener noreferrer"&gt;Material UI Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://picocss.com/docs" rel="noopener noreferrer"&gt;Pico CSS Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Style_sheet_language" rel="noopener noreferrer"&gt;Wikipedia - style sheet language&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Bootstrap_(front-end_framework)" rel="noopener noreferrer"&gt;Wikipedia - bootstrap&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>javascript</category>
      <category>stylesheet</category>
      <category>html</category>
    </item>
    <item>
      <title>React Components</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Mon, 20 Jan 2025 03:59:06 +0000</pubDate>
      <link>https://dev.to/katherineh/react-components-l34</link>
      <guid>https://dev.to/katherineh/react-components-l34</guid>
      <description>&lt;h2&gt;
  
  
  What are components?
&lt;/h2&gt;

&lt;p&gt;All applications built using React are made up of &lt;strong&gt;components&lt;/strong&gt;. These components are the building blocks of whatever application we are trying to build, as they each represent a part of the user interface (UI) that is visible to the client. &lt;/p&gt;

&lt;p&gt;Instead of using HTML, React optionally uses &lt;strong&gt;JSX&lt;/strong&gt;, (JavaScript XML) to describe the layout of the UI. JSX looks a lot like HTML, but it works inside your JavaScript code. React then turns this JSX into JavaScript and updates the page for you.&lt;/p&gt;

&lt;p&gt;React components use &lt;strong&gt;props&lt;/strong&gt; (short for properties) to share data. Props let you pass this data, like a username, from one component to another.  This makes components &lt;em&gt;reusable&lt;/em&gt; because they can show different information depending on what props they get.  If you create a component to show a username, you don’t have to write different components for each user. Instead, you can just pass the username as a prop, and the component will change what it shows based on the value of the prop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of React Components:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Functional Components&lt;/li&gt;
&lt;li&gt;Class Components&lt;/li&gt;
&lt;li&gt;Pure Components&lt;/li&gt;
&lt;li&gt;High Order Components&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s focus on the two primary components: &lt;br&gt;
&lt;strong&gt;Functional Components&lt;/strong&gt; and &lt;strong&gt;Class Components.&lt;/strong&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  &lt;strong&gt;Functional Components&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Functional Components, also referred to as &lt;em&gt;Stateless Functional Components&lt;/em&gt;, are just JavaScript/ES6 Functions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They accept an object of properties (&lt;code&gt;props&lt;/code&gt;) and return HTML-like code written in JSX that describes the UI.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, say you want to have a message that shows that a user has logged in. You could create a &lt;code&gt;LoginMessage&lt;/code&gt; message component and use props to pass in a username. The component will dynamically update based on the &lt;code&gt;username&lt;/code&gt; prop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;LoginMessage&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&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;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; has logged in.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;LoginMessage&lt;/code&gt; component is a function that accepts &lt;code&gt;props&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The JSX inside the return statement uses &lt;code&gt;props.username&lt;/code&gt; to &lt;em&gt;dynamically&lt;/em&gt; display the username.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⭐ React component names are written in &lt;a href="https://www.theserverside.com/definition/Pascal-case#:~:text=Pascal%20case%20%2D%2D%20or%20PascalCase,names%20to%20include%20blank%20spaces." rel="noopener noreferrer"&gt;Pascal Case&lt;/a&gt;, meaning they always start with a capital letter (&lt;code&gt;LoginMessage&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;After &lt;code&gt;LoginMessage&lt;/code&gt; is declared, you can &lt;strong&gt;nest&lt;/strong&gt; it into another component like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LoginMessage&lt;/span&gt; &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Lucy"&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;LoginMessage&lt;/span&gt; &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Stilton"&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;LoginMessage&lt;/span&gt; &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Buddy"&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="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;ul&gt;
&lt;li&gt;The &lt;code&gt;App&lt;/code&gt; component uses the &lt;code&gt;LoginMessage&lt;/code&gt; component three times.&lt;/li&gt;
&lt;li&gt;Each &lt;code&gt;LoginMessage&lt;/code&gt; gets a different username as a prop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The output would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lucy has logged in.
Stilton has logged in.
Bud has logged in.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use a component later, you need to &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export" rel="noopener noreferrer"&gt;export&lt;/a&gt; it before you can import it to another component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;LoginMessage&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&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;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; has logged in.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&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="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;LoginMessage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;export default&lt;/code&gt; keywords mark the main component you want to send from a file. (In this case, &lt;code&gt;LoginMessage&lt;/code&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;export default&lt;/code&gt;  lets you import the component into another file without needing curly braces &lt;code&gt;{}&lt;/code&gt; and also lets you name it whatever you want.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can then &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import" rel="noopener noreferrer"&gt;import&lt;/a&gt; the function to the &lt;strong&gt;root component&lt;/strong&gt; (in this case, App.js) by using the &lt;code&gt;import&lt;/code&gt; declaration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;LoginMessage&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./LoginMessage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LoginMessage&lt;/span&gt; &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Lucy"&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="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;h1&gt;
  
  
  &lt;strong&gt;Class Components&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Class Components, also referred to as &lt;em&gt;Stateful Class Components&lt;/em&gt;, are built using ES6 classes. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They can accept properties (&lt;code&gt;props&lt;/code&gt;), similar to functional components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They have to have a &lt;code&gt;render( )&lt;/code&gt; method to return JSX.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Class components extend &lt;code&gt;React.Component&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They can also maintain a private internal &lt;strong&gt;state&lt;/strong&gt;.  &lt;a href="https://www.w3schools.com/react/react_state.asp" rel="noopener noreferrer"&gt;State&lt;/a&gt; is the data that a component can "remember" and change.  This means the component can handle &lt;em&gt;dynamic&lt;/em&gt; data, like a user's login status or the number of times a button is clicked.&lt;/p&gt;

&lt;p&gt;Here, the same &lt;code&gt;LoginMessage&lt;/code&gt; functional component can be written as a class component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LoginMessage&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&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;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; has logged in.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&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;ul&gt;
&lt;li&gt;The &lt;code&gt;LoginMessage&lt;/code&gt; component is a class that extends &lt;code&gt;React.Component&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It uses &lt;code&gt;this.props.username&lt;/code&gt; to access the &lt;code&gt;username&lt;/code&gt; prop.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Before React version 16.8, class components were used to manage state and &lt;a href="https://www.w3schools.com/react/react_lifecycle.asp" rel="noopener noreferrer"&gt;lifecycle methods&lt;/a&gt;. With the introduction of &lt;a href="https://www.w3schools.com/react/react_hooks.asp" rel="noopener noreferrer"&gt;React Hooks&lt;/a&gt;, functional components can now manage &lt;strong&gt;state&lt;/strong&gt; and &lt;strong&gt;lifecycle methods&lt;/strong&gt;, which makes class components less useful.&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://www.w3schools.com/react/react_hooks.asp" rel="noopener noreferrer"&gt;w3schools.com&lt;/a&gt;, "although Hooks generally replace class components, there are no plans to remove classes from React."&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;All applications are made up of components. React components are reusable _ that make up the user interface. They can be nested and contained in the root component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functional Components:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple functions that receive &lt;code&gt;props&lt;/code&gt; and return a declaration&lt;/li&gt;
&lt;li&gt;Most commonly used component, especially with React Hooks&lt;/li&gt;
&lt;li&gt;Mostly used for UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Class Components:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ES6 classes that extend &lt;code&gt;React.Component&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Can manage state and lifecycle methods&lt;/li&gt;
&lt;li&gt;Used less since the introduction of React Hooks&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://react.dev/learn" rel="noopener noreferrer"&gt;Learn React&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/react-components-jsx-props-for-beginners/" rel="noopener noreferrer"&gt;React Functional Components, Props, and JSX&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.freecodecamp.org/news/react-components-jsx-props-for-beginners/" rel="noopener noreferrer"&gt;Static vs. Dynamic Content: Understanding the Difference&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://javascript.info/import-export" rel="noopener noreferrer"&gt;Export and Import&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.theserverside.com/definition/Pascal-case#:~:text=Pascal%20case%20%2D%2D%20or%20PascalCase,names%20to%20include%20blank%20spaces." rel="noopener noreferrer"&gt;What is Pascal Case?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export" rel="noopener noreferrer"&gt;mdn - export&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import" rel="noopener noreferrer"&gt;mdn - import&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.w3schools.com/react/react_state.asp" rel="noopener noreferrer"&gt;w3schools - React State&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.w3schools.com/react/react_hooks.asp" rel="noopener noreferrer"&gt;w3schools - React Hooks&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=wIyHSOugGGw&amp;amp;t=220s&amp;amp;ab_channel=CodeBootcamp" rel="noopener noreferrer"&gt;Every React Concept Explained in 12 Minutes&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=Y2hgEGPzTZY&amp;amp;t=178s&amp;amp;ab_channel=Codevolution" rel="noopener noreferrer"&gt;ReactJS Tutorial - 4 - Components&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>jsx</category>
      <category>javascript</category>
    </item>
    <item>
      <title>JSON.stringify() &amp; JSON.parse()</title>
      <dc:creator>Katherine Hebbler</dc:creator>
      <pubDate>Thu, 14 Nov 2024 00:31:23 +0000</pubDate>
      <link>https://dev.to/katherineh/jsonstringify-jsonparse-1585</link>
      <guid>https://dev.to/katherineh/jsonstringify-jsonparse-1585</guid>
      <description>&lt;h2&gt;
  
  
  JSON
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.w3schools.com/js/js_json_intro.asp" rel="noopener noreferrer"&gt;JSON&lt;/a&gt;, or JavaScript Object Notation, is a text format for storing and transporting complex data. JavaScript includes simple methods for converting JSON text (stored as a String) to an Object or an Array, and JSON Objects and Arrays to JSON text. &lt;/p&gt;

&lt;p&gt;This is useful when transferring data to be read by different systems, because sometimes only text can be stored or transmitted between them. For example, when sending data from a web app to a server via HTTP, it needs to be sent as a String. &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Forms/Sending_and_retrieving_form_data" rel="noopener noreferrer"&gt;[.]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="noopener noreferrer"&gt;JSON.stringify()&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" rel="noopener noreferrer"&gt;JSON.parse()&lt;/a&gt; are built in Functions that can be used on JavaScript Objects and Arrays to convert them to and from JSON Strings.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;JSON.stringify()&lt;/code&gt; converts a JavaScript Object or Array to a JSON String, which can be stored as text.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;JSON.parse()&lt;/code&gt; converts a JSON String back into a JavaScript Object or Array.&lt;/p&gt;




&lt;p&gt;Here, I have an Array called &lt;code&gt;albums&lt;/code&gt; of album Objects, each containing two keys: &lt;code&gt;"artist"&lt;/code&gt; and &lt;code&gt;"title"&lt;/code&gt;:&lt;br&gt;
&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;let&lt;/span&gt; &lt;span class="nx"&gt;albums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&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;artist&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;Herbie Hancock&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;title&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;Head Hunters&lt;/span&gt;&lt;span class="dl"&gt;"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;Beastie Boys&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;title&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;Paul's Boutique&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&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;artist&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;The Cramps&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;title&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;Bad Music for Bad People&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;albums&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// [object Array] (3)&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;Herbie Hancock&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;title&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;Head Hunters&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;Beastie Boys&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;title&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;Paul's Boutique&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;The Cramps&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;title&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;Bad Music for Bad People&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When calling &lt;code&gt;console.log(albums);&lt;/code&gt;, the console sees that &lt;code&gt;albums&lt;/code&gt; is an Array and shows &lt;code&gt;[object Array]&lt;/code&gt; for the entire Array and &lt;code&gt;[object Object]&lt;/code&gt; for each item inside of it. This shorthand is used by default.&lt;/p&gt;




&lt;h2&gt;
  
  
  JSON.stringify()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;JSON.stringify()&lt;/code&gt; takes a JavaScript Array or Object and converts it into a JSON String (also called &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Serialization" rel="noopener noreferrer"&gt;serialization&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Here, I'm converting the &lt;code&gt;albums&lt;/code&gt; Array to a JSON String by invoking the &lt;code&gt;JSON.stringify()&lt;/code&gt; method on &lt;code&gt;albums&lt;/code&gt;, and assigning it to the variable &lt;code&gt;jsonAlbumsString&lt;/code&gt;:&lt;br&gt;
&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;let&lt;/span&gt; &lt;span class="nx"&gt;jsonAlbumsString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;jsonAlbumsString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;jsonAlbumsString&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"[{"artist": "Herbie Hancock", "title": "Head Hunters"}, {"artist": 
"Beastie Boys", "title": "Paul's Boutique"}, {"artist": "The Cramps", 
"title": "Bad Music for Bad People"}]";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This returns a JSON String representing an Array of three Objects, each with two properties.&lt;/p&gt;

&lt;p&gt;⭐JSON has specific formatting, so Strings are wrapped in double quotes&lt;code&gt;("")&lt;/code&gt;, and Object keys are &lt;em&gt;also&lt;/em&gt; wrapped in double quotes&lt;code&gt;("")&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  JSON.stringify() Parameters
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;JSON.stringify()&lt;/code&gt; Function accepts up to three &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#parameters" rel="noopener noreferrer"&gt;parameters&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#value" rel="noopener noreferrer"&gt;Value&lt;/a&gt;: the Object or Array to convert to a JSON String (in this case, &lt;code&gt;albums&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#replacer" rel="noopener noreferrer"&gt;Replacer&lt;/a&gt;(Optional): a Function that lets you modify each key-value pair. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set to &lt;code&gt;null&lt;/code&gt; if not needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space" rel="noopener noreferrer"&gt;Space&lt;/a&gt;(Optional): the number of spaces to use for indentation (in this case, &lt;code&gt;4&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;formattedAlbumString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albums&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formattedAlbumString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;formattedAlbumString&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;[
    {
        'artist': 'Herbie Hancock',
        'title': 'Head Hunters'
    },
    {
        'artist': 'Beastie Boys',
        'title': 'Paul's Boutique'
    },
    {
        'artist': 'The Cramps',
        'title': 'Bad Music for Bad People'
    }
]&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, each Object is now formatted with indentation, making it easier to debug and improving readability.&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%2Fmy08b3obiodyywr0hw44.jpg" 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%2Fmy08b3obiodyywr0hw44.jpg" alt="Albums1" width="511" height="169"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Next, I've created a String, &lt;code&gt;albumsString&lt;/code&gt;, representing three album Objects, each containing two keys: &lt;code&gt;"artist"&lt;/code&gt; and &lt;code&gt;"title"&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;(I've wrapped it in single quotes for readability.)&lt;br&gt;
&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;let&lt;/span&gt; &lt;span class="nx"&gt;albumsString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[{"artist": "Bad Brains", "title": "Bad Brains"}, 
{"artist": "A Tribe Called Quest", "title": "The Low End Theory"}, {"artist": 
"Nina Simone", "title": "Wild is the Wind"}]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albumsString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;albumsString&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"[{'artist': 'Bad Brains', 'title': 'Bad Brains'}, {'artist': 'A Tribe 
Called Quest', 'title': 'The Low End Theory'}, {'artist': 'Nina Simone', 
'title': 'Wild is the Wind'}]"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;albumsString.length&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albumsString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// length of String&lt;/span&gt;
&lt;span class="mi"&gt;172&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The length is &lt;code&gt;172&lt;/code&gt; because &lt;code&gt;albumsString&lt;/code&gt; is a single string, even though it looks like an Array of Objects.&lt;/p&gt;




&lt;h2&gt;
  
  
  JSON.parse()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;JSON.parse()&lt;/code&gt; takes a JSON String and converts it into a JavaScript Object or Array (also called &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Deserialization" rel="noopener noreferrer"&gt;deserialization&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Here, I'm converting &lt;code&gt;albumsString&lt;/code&gt; to an Array of Objects by invoking the &lt;code&gt;JSON.parse()&lt;/code&gt; method on it, and assigning it to the variable &lt;code&gt;parsedAlbumsArray&lt;/code&gt;:&lt;br&gt;
&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;let&lt;/span&gt; &lt;span class="nx"&gt;parsedAlbumsArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albumsString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parsedAlbumsArray&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;parsedAlbumsArray&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// [object Array] (3)&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;Bad Brains&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;title&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;Bad Brains&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;A Tribe Called Quest&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;title&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;The Low End Theory&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;Nina Simone&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;title&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;Wild is the Wind&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging &lt;code&gt;parsedAlbumsArray.length&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parsedAlbumsArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// length of Array&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, &lt;code&gt;parsedAlbumsArray.length&lt;/code&gt; will be &lt;code&gt;3&lt;/code&gt; because it is an Array with three elements.&lt;/p&gt;




&lt;h2&gt;
  
  
  JSON.parse() Parameters
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;JSON.parse()&lt;/code&gt; Function accepts up to two &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#parameters" rel="noopener noreferrer"&gt;parameters&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#text" rel="noopener noreferrer"&gt;Text&lt;/a&gt;: the string to parse as JSON (in this case, &lt;code&gt;albumsString&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#reviver" rel="noopener noreferrer"&gt;Reviver&lt;/a&gt;: a Function that takes two parameters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;key&lt;/code&gt;: the key associated with the value&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;value&lt;/code&gt;: the value being parsed&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The reviver Function is invoked recursively for each key-value pair.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"This reviver Function can be thought of as a filter Function." &lt;a href="https://usefulangle.com/post/112/json-parse-reviver-function" rel="noopener noreferrer"&gt;[.]&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here, I'm using &lt;code&gt;JSON.parse()&lt;/code&gt; with a reviver Function to parse &lt;code&gt;albumsString&lt;/code&gt; and filter its Objects so that I get only the albums by the artist "Nina Simone":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// initializing storage array&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;ninaSimoneAlbums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="c1"&gt;// parsing albumsString&lt;/span&gt;
  &lt;span class="c1"&gt;// using reviver to filter key-value pairs&lt;/span&gt;
&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;albumsString&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&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;// if "artist" === "Nina Simone"&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;key&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Nina Simone&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// adding value to ninaSimoneAlbums&lt;/span&gt;
    &lt;span class="nx"&gt;ninaSimoneAlbums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;artist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// returning value &lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ninaSimoneAlbums&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The reviver Function checks if the key is &lt;code&gt;"artist"&lt;/code&gt; and the value is &lt;code&gt;"Nina Simone"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If both conditions are true, it adds the Object &lt;code&gt;{ artist: value }&lt;/code&gt; to the &lt;code&gt;ninaSimoneAlbums&lt;/code&gt; Array.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Logging &lt;code&gt;ninaSimoneAlbums&lt;/code&gt; gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// [object Array] (1)&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="c1"&gt;// [object Object] &lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;artist&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;Nina Simone&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;title&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;Wild is the Wind&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;And if I want, I can convert &lt;code&gt;ninaSimoneAlbums&lt;/code&gt; and &lt;code&gt;parsedAlbumsArray&lt;/code&gt; back into JSON Strings using &lt;code&gt;JSON.stringify()&lt;/code&gt; again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ninaSimoneAlbums&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parsedAlbumsArray&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logging this code gives the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;[{'artist':'Nina Simone'}]&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;[
     {
          'artist': 'Bad Brains',
          'title': 'Bad Brains'
     },
     {
          'artist': 'A Tribe Called Quest',
          'title': 'The Low End Theory'
     },
     {
          'artist': 'Nina Simone',
          'title': 'Wild is the Wind'
     }
]&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fsf84vltkrjg3cmvdui00.jpg" 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%2Fsf84vltkrjg3cmvdui00.jpg" alt="Albums2" width="513" height="168"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;code&gt;JSON.stringify()&lt;/code&gt; and &lt;code&gt;JSON.parse()&lt;/code&gt; are essential methods for working with JSON data. They allow you to convert complex JavaScript Objects and Arrays into JSON Strings and back again, making it easier to store and transfer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;JSON.stringify()&lt;/code&gt; converts JavaScript Objects an Arrays into JSON Strings.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;JSON.parse()&lt;/code&gt; converts JSON Strings back into JavaScript Objects or Arrays.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These Functions allow for easy data exchange between systems.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3schools.com/js/js_json_intro.asp" rel="noopener noreferrer"&gt;w3schools - JSON&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Forms/Sending_and_retrieving_form_data" rel="noopener noreferrer"&gt;mdn - Sending and Retrieving Form Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="noopener noreferrer"&gt;mdn - JSON.stringify()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" rel="noopener noreferrer"&gt;mdn - JSON.parse()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Serialization" rel="noopener noreferrer"&gt;mdn - Serialization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#parameters" rel="noopener noreferrer"&gt;mdn - Stringify: Parameters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#value" rel="noopener noreferrer"&gt;mdn - Stringify: Value&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#replacer" rel="noopener noreferrer"&gt;mdn - Stringify: Replacer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space" rel="noopener noreferrer"&gt;mdn - Stringify: Space&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Deserialization" rel="noopener noreferrer"&gt;mdn - Deserialization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#parameters" rel="noopener noreferrer"&gt;mdn - Parse: Parameters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#text" rel="noopener noreferrer"&gt;mdn - Parse: Text&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#value" rel="noopener noreferrer"&gt;mdn - Parse: Value&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/js-json-parse-stringify" rel="noopener noreferrer"&gt;digitalocean - How To Use JSON.parse() and JSON.stringify()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.json.org/json-en.html" rel="noopener noreferrer"&gt;JSON.org&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>json</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
