<?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: Silas</title>
    <description>The latest articles on DEV Community by Silas (@silaslelei).</description>
    <link>https://dev.to/silaslelei</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3716579%2F59e2dceb-c213-4bea-b911-f0a1f02a9dc7.png</url>
      <title>DEV Community: Silas</title>
      <link>https://dev.to/silaslelei</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/silaslelei"/>
    <language>en</language>
    <item>
      <title>Understanding Components and Props</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Wed, 03 Jun 2026 14:00:54 +0000</pubDate>
      <link>https://dev.to/silaslelei/understanding-components-and-props-94o</link>
      <guid>https://dev.to/silaslelei/understanding-components-and-props-94o</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
What are Components

&lt;ul&gt;
&lt;li&gt;Exporting functions and components&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Props

&lt;ul&gt;
&lt;li&gt;Props as functions&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Exercise&lt;/li&gt;

&lt;/ul&gt;




&lt;p&gt;Hello again. If you are reading this, you are interested in React. This is the second in the React Introductory series. Check out &lt;a href="https://dev.to/silaslelei/getting-started-with-reactjs-3ag2"&gt;Introduction to React&lt;/a&gt; if you haven't. &lt;/p&gt;

&lt;p&gt;Let's continue ...&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Components
&lt;/h2&gt;

&lt;p&gt;These are, ideally, the smallest building blocks of a page or user interface. They include buttons, input boxes, radio buttons and check boxes etc.&lt;br&gt;
These are what make up a page and are used for data input and user interactions.&lt;/p&gt;

&lt;p&gt;Components make use and/or take the syntax of html elements. The html elements include:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div&amp;gt;&amp;lt;/div&lt;/code&gt; - creates a container&lt;br&gt;
&lt;code&gt;&amp;lt;input type="text"/&amp;gt;&lt;/code&gt; - creates an input box&lt;br&gt;
&lt;code&gt;&amp;lt;button&amp;gt;Button&amp;lt;/button&amp;gt;&lt;/code&gt; - creates a button&lt;br&gt;
...&lt;br&gt;
and so on.&lt;/p&gt;

&lt;p&gt;React components, are generally created or defined inside a .jsx file. The definition(or component) must subsequently be exported to make it usable and accessible across the entire app.&lt;/p&gt;

&lt;p&gt;In React basic structure, components live inside &lt;code&gt;App-folder/src/components&lt;/code&gt; folder. &lt;/p&gt;

&lt;p&gt;So, go ahead and create a button component in the component directory. Create a file &lt;code&gt;Button.jsx&lt;/code&gt; or whatever you decide to call it, but remember to add the .jsx extension, to tell the compiler that this is a React component.&lt;/p&gt;

&lt;p&gt;Inside this file, add the following:&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;function&lt;/span&gt; &lt;span class="nf"&gt;Button&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that we did not start with &lt;code&gt;import react from "react"&lt;/code&gt;.&lt;br&gt;
As from react 18, this has been automated, and the compiler will automatically(behind the scenes), import this package thus allowing you to continue without that particular import directive.&lt;/p&gt;

&lt;p&gt;You have now written your first component. However, we are not done yet. Trying to use this will throw an error. But why??&lt;br&gt;
You guessed it right. EXPORT!! We have not exported the function/component.&lt;/p&gt;
&lt;h3&gt;
  
  
  Exporting Functions and Components
&lt;/h3&gt;

&lt;p&gt;There are 2 ways of exporting. You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Export as you define the component&lt;/li&gt;
&lt;li&gt;Export once you are done defining&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The only difference between the two is the placement of the &lt;code&gt;export&lt;/code&gt; keyword.&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;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Button&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&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;function&lt;/span&gt; &lt;span class="nf"&gt;Button&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above definition is what we call &lt;strong&gt;React Function component&lt;/strong&gt;. There is another definition that uses &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions" rel="noopener noreferrer"&gt;Arrow Functions&lt;/a&gt;.&lt;br&gt;
The layout of an arrow function component looks like this:&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;return&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;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt; &lt;span class="nx"&gt;Arrow&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&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;Button&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;return&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;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt; &lt;span class="nx"&gt;am&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt; &lt;span class="nx"&gt;Arrow&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both definitions of arrow function and native function have slightly different syntax, but the two will give the same expected output&lt;/p&gt;

&lt;p&gt;We have now written and exported our first component. To see it in action, open our App.jsx.&lt;/p&gt;

&lt;p&gt;To use a component in another component or page, you will need to import it.&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Button.jsx&lt;/span&gt;&lt;span class="dl"&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="k"&gt;return&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;Button&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Now save and run &lt;code&gt;npm run dev&lt;/code&gt; and open &lt;code&gt;http://localhost:5173&lt;/code&gt; and see our button.&lt;/p&gt;

&lt;p&gt;When do we do &lt;code&gt;import { Button } from "./component"&lt;/code&gt; and when do we do &lt;code&gt;import Button from "./component"&lt;/code&gt;?&lt;br&gt;
&lt;strong&gt;TODO&lt;/strong&gt; : Read about Exports &lt;a href="https://medium.com/@devonmobile/default-import-vs-named-import-in-javascript-es6-44fc5c7ec91a" rel="noopener noreferrer"&gt;here&lt;/a&gt; and be able to tell the difference&lt;/p&gt;
&lt;h2&gt;
  
  
  Props
&lt;/h2&gt;

&lt;p&gt;Props is short for &lt;strong&gt;properties&lt;/strong&gt;. These are characteristics or definitions unique to an element. Just like attributes in html, props are used to pass data between elements in a page.&lt;br&gt;
Props are passed into a jsx element as arguments of a function.&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;function&lt;/span&gt; &lt;span class="nf"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;width&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Props can be of any data type: e.g string, boolean, number, object or even functions.&lt;/p&gt;

&lt;p&gt;But why &lt;code&gt;({onClick})&lt;/code&gt; instead of &lt;code&gt;(onClick)&lt;/code&gt; ??&lt;br&gt;
Well, Every JSX has a default object property attached to it. So when you pass in a property, the property becomes a field in that object.&lt;br&gt;
&lt;code&gt;{onClick}&lt;/code&gt; - this uses &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring" rel="noopener noreferrer"&gt;destructuring&lt;/a&gt; to get the actual props&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(props)&lt;/code&gt; - this uses renames the default props to the name given. To access the actual props, you will have to do &lt;code&gt;props.onClick&lt;/code&gt;,&lt;code&gt;props.color&lt;/code&gt; and so on.&lt;/p&gt;

&lt;p&gt;Props are useful to send data from parent component to child and from child to parent.&lt;/p&gt;

&lt;p&gt;It is worth noting that passing a prop from one element to another will be detected by react, and if that prop changes, react will trigger a re-render. When components are deeply nested and one prop has to make way down to n-th level, when the prop is passed from parent to n, this is what would be termed as &lt;strong&gt;PROP DRILLING&lt;/strong&gt;. This causes unnecessary rerenders.&lt;br&gt;
One way to fix this is by using a global store that elements and components can directly access without depending on other components&lt;/p&gt;

&lt;p&gt;Let's see these in action:&lt;br&gt;
Create a Car.jsx component in components folder&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;make&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;model&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="k"&gt;return&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;span&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;make&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;color&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;/span&lt;/span&gt;&lt;span class="err"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Car.jsx&lt;/span&gt;&lt;span class="dl"&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="k"&gt;return&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;Car&lt;/span&gt; &lt;span class="nx"&gt;make&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Toyota&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tacoma&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Silver&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&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;App&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running this should give you something like this:&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%2F40dqokim07uyo3c1lfc5.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%2F40dqokim07uyo3c1lfc5.png" alt="React example" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Props as functions
&lt;/h3&gt;

&lt;p&gt;Let's go through this example. We will, for this one call a function that is residing on the parent from the child.&lt;/p&gt;

&lt;p&gt;So, defined our component.&lt;br&gt;
Our component receives a destructured prop,onClick, from the parent.&lt;br&gt;
Our button has an onClick attribute. This defines the event that happens when the button gets clicked. In this case, the onClick will be called.&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;setClick&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="k"&gt;return&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;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;setClick&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, in the parent component, in our case, App.jsx, we define the function that will get executed when the button in the child component will be clicked.&lt;br&gt;
setClick prop is now set to handleClick function, and this should trigger a console.log("Clicked), which should display a "Clicked" message on the console.&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Car.jsx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleClick&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Clicked&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="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="k"&gt;return&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;Car&lt;/span&gt; &lt;span class="nx"&gt;setClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&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;App&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have successfully passed props between parent and child and executed parent functions from child component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TODO&lt;/strong&gt;: Create a child component with a button that will increment a counter on the parent.&lt;/p&gt;

&lt;p&gt;Assuming you have done the above, let's go through it.&lt;br&gt;
Create a button component like we did above:&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;onClick&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="k"&gt;return&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;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increment&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;     &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in our App.js, let's import and add the button component:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Button.jsx&lt;/span&gt;&lt;span class="dl"&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
   &lt;span class="c1"&gt;//increment logic will go here&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Count&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/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="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;App&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will introduce a state manager, useState, to keep track of our state 'count' and rerender the component on change.&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Button.jsx&lt;/span&gt;&lt;span class="dl"&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="c1"&gt;//create our state variables&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&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;increment&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
   &lt;span class="c1"&gt;//increment logic will go here&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/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="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;App&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 0 in useState(0) tells the compiler that count is of type number and the default value is 0. Default values can include objects, strings, booleans, pretty much any data type.&lt;/p&gt;

&lt;p&gt;From our previous lesson, you remember how to set state. We want to change the state value everytime the button is clicked.&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;function&lt;/span&gt; &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
   &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;prev&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, save everything and run your server.&lt;br&gt;
You should get a &lt;code&gt;Count: 0&lt;/code&gt; and a button &lt;code&gt;Increment&lt;/code&gt;. Clicking the button will increment the count value.&lt;/p&gt;

&lt;p&gt;Congratulations!! You have used state, passed props and exported components.&lt;br&gt;
Now do the exercise below to challenge yourself even more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exercise
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Exercise&lt;/strong&gt;: Create a color changer. A box and an input field. The box will change color to the color specified in the input field.(This introduces you to CSS styling of components as well as what we have gone through).&lt;/p&gt;

&lt;p&gt;Happy hacking, see you in the next one!!&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Getting Started with ReactJS</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Mon, 18 May 2026 08:12:24 +0000</pubDate>
      <link>https://dev.to/silaslelei/getting-started-with-reactjs-3ag2</link>
      <guid>https://dev.to/silaslelei/getting-started-with-reactjs-3ag2</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Installation&lt;/li&gt;
&lt;li&gt;JSX Basics&lt;/li&gt;
&lt;li&gt;useState&lt;/li&gt;
&lt;li&gt;useEffect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Ever wanted to get started with react but just couldn't find the straight-to-the-point guide and you also couldn't handle sitting through hours of tutorials? Well, let's try it this way.&lt;/p&gt;

&lt;p&gt;I will not even try to get you from 0-100 of react in this one post. Just a little push is what I promise, so let's dive right in.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is React
&lt;/h2&gt;

&lt;p&gt;React is a popular open-source javascript framework by Meta used primarily for building user interfaces majorly for single page applications. &lt;/p&gt;




&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;To get started, you need to have node (and npm) installed. To install, follow the guide &lt;a href="https://nodejs.org/en/download" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installation is complete, you can confirm by running &lt;code&gt;node -v&lt;/code&gt; on your terminal(or command prompt), which should output something like &lt;code&gt;v24.9.0&lt;/code&gt;. That should confirm the installation was successful.&lt;/p&gt;




&lt;h3&gt;
  
  
  Install React
&lt;/h3&gt;

&lt;p&gt;Over the years, react installation has changed from the traditional &lt;code&gt;create-react-app&lt;/code&gt; to more reliable and efficient methods of using scaffolds, specifically vite.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;open your terminal(if not already opened)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to your desired directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;npm create vite@latest&lt;/code&gt; This will prompt you for a few inputs like project name, framework as shown:&lt;/p&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%2Fcayk186rj85krhu8ksc4.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%2Fcayk186rj85krhu8ksc4.png" alt="terminal" width="300" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, execute the last 3 commands shown : cd project-name, npm install and finally npm run dev.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;npm install&lt;/code&gt; installs the dependencies required by the project as defined in package.json&lt;br&gt;
&lt;code&gt;npm run dev&lt;/code&gt; starts the development server which runs your project locally.&lt;/p&gt;

&lt;p&gt;And that's our checkpoint. You have successfully installed and ran a react project.&lt;/p&gt;

&lt;p&gt;As of vite 8, the setup comes with:&lt;br&gt;
&lt;code&gt;/public&lt;/code&gt; - this directory contains public assets like images&lt;br&gt;
&lt;code&gt;/src&lt;/code&gt; - contains all the source code of the app&lt;br&gt;
&lt;code&gt;.gitignore&lt;/code&gt; - default populated .gitignore template &lt;br&gt;
&lt;code&gt;eslint.config.js&lt;/code&gt; - configuration for the linter&lt;br&gt;
&lt;code&gt;index.html&lt;/code&gt; - the main html file that react appends components&lt;br&gt;
&lt;code&gt;package*.json&lt;/code&gt; - stores configuration and dependencies for the app&lt;br&gt;
&lt;code&gt;README.md&lt;/code&gt; - basic vite documentation&lt;br&gt;
&lt;code&gt;vite.config.js&lt;/code&gt; - configuration for vite development server&lt;/p&gt;

&lt;p&gt;Inside src, we have 2 css and 2 jsx files. The .jsx files are native to react, they denote react components. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;App.css&lt;/code&gt; is styling used within App.jsx whereas &lt;br&gt;
&lt;code&gt;index.css&lt;/code&gt; is a global styling sheet for index.html, which App inherits.&lt;br&gt;
&lt;code&gt;Main.jsx&lt;/code&gt; is the entrypoint of the app. This is where the react app is injected into index.html's &lt;code&gt;&amp;lt;div id="root"&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Now let's code ...
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Delete everything in App.jsx and replace it with this:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&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 you run the server , &lt;code&gt;npm run dev&lt;/code&gt; and open the address &lt;code&gt;http://localhost:5173&lt;/code&gt; in browser, you should see &lt;code&gt;Hello React&lt;/code&gt; displayed&lt;/p&gt;


&lt;h2&gt;
  
  
  JSX Basics
&lt;/h2&gt;

&lt;p&gt;JSX(Javascript XML) is a syntax that allows you to write HTML-like code within Javascript. This is what aims to make react easy and intuitive, and make transition from HTML almost seamless.&lt;br&gt;
JSX will look almost exactly like HTML, but with a few differences:&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;//jsx&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;container&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;
&lt;span class="nx"&gt;instead&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;

&lt;span class="c1"&gt;//html&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="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;container&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is worth noting that, a JSX component or function MUST return ONLY ONE child/parent component. Having more than one will result in React throwing an error.&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;//only one element is returned. This will work&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="k"&gt;return&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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//More than one element is returned. This will NOT work&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="k"&gt;return&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;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Another&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;will&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt; &lt;span class="nx"&gt;compilation&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure to only have one parent element always: To fix the above, do this:&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;function&lt;/span&gt; &lt;span class="nf"&gt;App&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Another&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;will&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt; &lt;span class="nx"&gt;compilation&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This consequently wraps all the elements in one parent div and thus the jsx only returns one element.&lt;/p&gt;




&lt;h2&gt;
  
  
  Manage States with useState()
&lt;/h2&gt;

&lt;p&gt;In React, you will run into a number of functions that start with &lt;strong&gt;use&lt;/strong&gt; e.g useState, useEffect, useContext and so on. These are called Hooks. We will learn later about them in depth.&lt;br&gt;
For now, we will start with the common ones: useState and useEffect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;useState&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a snapshot of a component(and its data) at a particular point in time. Component's data changes over time, so each change represent a new state.&lt;br&gt;
React has a state manager, &lt;code&gt;useState()&lt;/code&gt; to manage change in states. When a state changes, react triggers a re-render of that component to show the change, e.g user typing into a textfield. Every keypress is a new state hence the textbox is re-rendered with the new data everytime.&lt;/p&gt;

&lt;p&gt;To use this, first import useState at the top of the file:&lt;br&gt;
&lt;code&gt;import {useState} from 'react'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Within the function body:&lt;br&gt;
&lt;code&gt;const [count,setCount] = useState(0)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;useState() takes a default value that represents the datatype of what the state stores.&lt;br&gt;
Our example tells us that count is of type &lt;code&gt;int&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;count&lt;/code&gt; -&amp;gt; state variable&lt;br&gt;
&lt;code&gt;setCount&lt;/code&gt; -&amp;gt; function to change state.&lt;/p&gt;

&lt;p&gt;** NB: you should NEVER directly change &lt;code&gt;count&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prev&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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;count&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increment&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/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="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;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows us a simple implementation of useState() in action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TODO&lt;/strong&gt;: Try implement a decrement.&lt;/p&gt;




&lt;h2&gt;
  
  
  UseEffect
&lt;/h2&gt;

&lt;p&gt;This hook is used to define an action done when a particular event happens.&lt;br&gt;
It is used to define what happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Immediately the app loads/runs&lt;/li&gt;
&lt;li&gt;When a state changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The syntax for this is:&lt;/p&gt;

&lt;p&gt;First, import: &lt;code&gt;import { useEffect } from react&lt;/code&gt;&lt;br&gt;
Second, implement: &lt;/p&gt;

&lt;h3&gt;
  
  
  Pattern 1: Run on Every Render
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This runs after EVERY render&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;// No dependency array = runs every time the component re-renders&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pattern 2: Run Once on Mount
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This runs O
NCE when component first appears&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="c1"&gt;// Empty array [] = runs only on initial mount&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pattern 3: Run When Dependencies Change
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This runs when 'count' changes&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="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="c1"&gt;// Array with variables = runs when any of those variables change&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Dependency Array Explained&lt;/strong&gt;&lt;br&gt;
Think of the dependency array as React asking: "What should I watch for changes?"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No array - "Watch everything, run after every render"&lt;/li&gt;
&lt;li&gt;Empty [] - "Watch nothing, run once and done"&lt;/li&gt;
&lt;li&gt;[count, name] - "Watch count and name, run when either changes"
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Runs every render&lt;/span&gt;
  &lt;span class="nf"&gt;useEffect&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Component rendered&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;// Runs once when app starts&lt;/span&gt;
  &lt;span class="nf"&gt;useEffect&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App mounted - this runs once&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="c1"&gt;// Runs when count changes&lt;/span&gt;
  &lt;span class="nf"&gt;useEffect&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="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="s2"&gt;`Count changed to: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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="nx"&gt;count&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;prev&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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&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;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increment&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/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="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;App&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;TODO&lt;/strong&gt;:&lt;br&gt;
Open your browser console and click the increment button. Watch the console to see which useEffect hooks run and when.&lt;/p&gt;

&lt;p&gt;Note: You might see each log appear twice in development mode. This is React's StrictMode deliberately rendering components twice to help catch bugs - it only happens in development, not in production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Use Cases&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[] empty array: Fetching initial data, setting up event listeners&lt;/li&gt;
&lt;li&gt;[dependency]: Fetching new data when a filter changes, updating localStorage when state changes&lt;/li&gt;
&lt;li&gt;No array: Usually avoided unless you need something to happen on every render&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide has introduced you to JSX,useState and useEffect hooks in react.&lt;/p&gt;

&lt;p&gt;Check out &lt;a href="https://dev.to/silaslelei/understanding-components-and-props-94o"&gt;Understanding Components and Props&lt;/a&gt; to continue with your journey&lt;/p&gt;

&lt;p&gt;Keep practicing, see you on the next one.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>Rocks vs Hard Places</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Mon, 20 Apr 2026 07:54:11 +0000</pubDate>
      <link>https://dev.to/silaslelei/rocks-vs-hard-places-4c7i</link>
      <guid>https://dev.to/silaslelei/rocks-vs-hard-places-4c7i</guid>
      <description>&lt;p&gt;"Between a rock and a hard place". We have all (probably) come across this phrase, or even worse, experienced it, lived through it.&lt;br&gt;
When you hear this, what goes on in your mind? What sparks?&lt;/p&gt;

&lt;p&gt;In such a situation, you are always faced with two difficult options to choose one. Neither is pleasant, but you have to choose the scorpion or the snake, the pan or the fire.&lt;/p&gt;

&lt;p&gt;I hope life has been fair to you!!&lt;/p&gt;

&lt;p&gt;How does this relate to programming you ask?&lt;/p&gt;

&lt;p&gt;Let's kick it up a notch.&lt;/p&gt;
&lt;h2&gt;
  
  
  Code... Rocks... Hard Places
&lt;/h2&gt;

&lt;p&gt;Updates are a crucial part of software, from your OS to you apps, to even your wardrobe!!&lt;br&gt;
We know the craze that comes with new releases of devices and whatnots. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;iPhone 17 pre-order demand is significantly higher than the iPhone 16, with analysts reporting a 5-10% increase in early sales. The Pro Max model leads demand, with 60% higher production to meet demand, while the new "iPhone Air" model has seen a strong, high-demand release. China is seeing record-breaking demand&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are 2 categories of people. Those who will update to the latest versions of...anything, versus the ones who stick to the old. No harm in either, no judgement whatsoever.&lt;br&gt;
In the context of updates, Kenya's giant telco, Safaricom, released a major update to their unified MyOneApp received a lot of backlash about it, but that had a different tune to our current song, so we wont get into it.&lt;/p&gt;

&lt;p&gt;My big question to you is, why would you update (or apt upgrade ;)) to a newer version? Let me hear your thoughts.&lt;/p&gt;
&lt;h3&gt;
  
  
  Story time ...
&lt;/h3&gt;

&lt;p&gt;I have been used to the normal way of doing things:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create vite@latest 
npm i tailwindcss @tailwindcss/vite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Things always worked seamlessly, I was always a happy man. My last status check said that i was on Vite 7 and tailwind 4.&lt;br&gt;
I ran my project well without fusses.&lt;/p&gt;

&lt;p&gt;Then came this one day, I need to whip something up, so I do the usual, and suddenly I was running into errors. When your terminal goes blood red, you know someone(I mean something) is dead!!&lt;br&gt;
Now I was panicking and not knowing what to do, because I needed to ship something.&lt;/p&gt;

&lt;p&gt;The new vite was looking awesome and flashy, shifting to a more 'purple-y' theme. Our traditional yellow-orange &lt;a href="https://www.imdb.com/title/tt0448115/" rel="noopener noreferrer"&gt;shazam&lt;/a&gt;-like logo and what we were used to has now gotten a facelift(depending on how you choose to see it).&lt;/p&gt;

&lt;p&gt;On an abnormal level, my OCD😉 doesn't allow me to be out-of date. I'm talking about going to the app store and just hitting update because I can and because that notification has some alert badge/pill on it.&lt;br&gt;
I'm talking about some &lt;code&gt;sudo apt update&lt;/code&gt; and 'sudo apt upgrade' just because it said &lt;code&gt;17 packages can be upgraded to latest version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Sometimes it works, and sometimes it just turns around and bites you where you can't see.&lt;/p&gt;

&lt;p&gt;After so many keystrokes and keyboard wars, I (my OCD) was faced with the brutal... Keep vite 8 and forget about Tailwind(probably it still could work with postcss and autoprefixer, but meh!!), or go down a rung, back to vite 7.&lt;br&gt;
Because I was in need, I took a glass of water and swallowed my pride😂.&lt;/p&gt;

&lt;p&gt;Of course after a few unanswered DM's and tags to Tailwindcss and Vite,  few weeks later, Tailwindcss 4.2.2 came out and my happiness was restored... Of course I hit the &lt;code&gt;npm i vite@latest&lt;/code&gt; as soon as I could, bumped up tailwind as well, fought with package-lock.json and node_modules for a while, and I won (of course the system won).&lt;/p&gt;

&lt;p&gt;I dont refute that updates are essential, especially on the security side of things(and with how fast react changes), there is another OCD side of &lt;code&gt;found [X] vulnerabilities ([Y] low, [Z] moderate, [A] high, [B] critical)&lt;/code&gt;. That thing scaaaarreesss me!! It always sends me scrambling to &lt;code&gt;npm audit fix&lt;/code&gt;, and it's not like I'm making a fintech app...Its just a ToDo list!&lt;/p&gt;

&lt;p&gt;So, would you always need to update? Do you read the changelogs and the effects it would have, or you just FAFO and taste it like I did?&lt;br&gt;
Let me know your crazy experiences on &lt;strong&gt;Latest&lt;/strong&gt;(rock) and &lt;strong&gt;Stable&lt;/strong&gt;(hard place) side of versions.&lt;/p&gt;

&lt;p&gt;Lets keep Reacting!&lt;/p&gt;

</description>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>Bash, Coffee, and Me: Learning Shell without losing your Mind</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Mon, 02 Mar 2026 08:42:58 +0000</pubDate>
      <link>https://dev.to/silaslelei/bash-coffee-and-me-learning-shell-without-losing-your-mind-50fj</link>
      <guid>https://dev.to/silaslelei/bash-coffee-and-me-learning-shell-without-losing-your-mind-50fj</guid>
      <description>&lt;p&gt;Its a cold Monday morning and the coffee doesn't seem to have hit the endpoint yet, or maybe it has and gotten a 400-500 HTTP status code response.&lt;br&gt;
As I wait for that to resolve, I find warmth in being bourne again. I am in the bourne again shell, get it?&lt;/p&gt;

&lt;p&gt;Bash has always felt a bit intimidating, and just a bit far out of my reach.  Always looking mean and something too big to wrap my head around.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wait, What is Bash?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Bash is a command-line interpreter and shell for Unix-like operating systems (Linux, macOS) that allows users to interact with the OS via text-based commands. It serves as the default interface for executing, automating, and scripting system tasks, acting as a bridge between the user and the kernel&lt;/code&gt;.&lt;a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)" rel="noopener noreferrer"&gt;🔗&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But the problem, I think, was me trying to swallow it whole. Fast forward time to a few days ago, a peer introduced me to a game. Oh how I love games!! &lt;br&gt;
This game gets you started on the essentials of bash. I was well versed with the very basic, or rather the ones I'd use on a daily basis: ls, mkdir, touch and a few others, so those ones didn't really raise my 'spidey senses'.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basics?
&lt;/h3&gt;

&lt;p&gt;So, lets go through what I call 'the very basics':&lt;br&gt;
&lt;code&gt;ls&lt;/code&gt;: lists contents of a directory &lt;br&gt;
&lt;code&gt;mkdir name&lt;/code&gt;: creates a new directory 'name' in the current directory&lt;br&gt;
&lt;code&gt;touch name&lt;/code&gt;: creates a new file 'name' in the current directory&lt;/p&gt;

&lt;p&gt;Most of these commands take overloads or parameters or flags which are placed after the command to add more options or coverage to them.&lt;br&gt;
As we have already seen, ls just outputs the contents of a directory, both files and folders, with barely no distinction.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deep (or shallow) dive into ls
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ls -l&lt;/code&gt; : This is "long listing". It will give you the contents of the current directory together with more info about each content. You will get an output resembling this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;drwxr-xr-x 2 ksilas cohort2    4096 Feb 17 13:27 algorithm&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;The first letter d&lt;/code&gt; shows that 'algorithm' is a directory. A file would be denoted with a -&lt;br&gt;
The second batch (position &lt;code&gt;2,3,4&lt;/code&gt;) which are &lt;code&gt;rwx&lt;/code&gt; represent the permission assigned to the user: r-read, w-write, x-execute&lt;br&gt;
The next 3 in position &lt;code&gt;5,6,7&lt;/code&gt; are also permissions for the group the user/file is in.&lt;br&gt;
The &lt;code&gt;last 3&lt;/code&gt; are permissions for others. These permissions apply to users who are not owners and are not not in the user group.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;number&lt;/code&gt; that follows the permission, &lt;code&gt;2&lt;/code&gt;, represents the number of hard links in the directory.&lt;/p&gt;

&lt;p&gt;The next text, &lt;code&gt;ksilas&lt;/code&gt; represent the owner of the file, and &lt;code&gt;cohort2&lt;/code&gt; represents the group in which the file belongs to. By default, the group will be the one the owner belongs to.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;4096&lt;/code&gt; is the size, in bytes, of the file or directory&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Feb 17 13:27&lt;/code&gt; represents the date and time the file/directory was last modified.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;algorithm&lt;/code&gt; would then finally represent the current items with the above stats.&lt;/p&gt;

&lt;h3&gt;
  
  
  Still There?
&lt;/h3&gt;

&lt;p&gt;Already overwhelming, right???😄 Stay with me. I haven't shown you something amazing. We want to find a file with a particular name, and of course the directory.&lt;br&gt;
This is where I shut down😰.&lt;br&gt;
What is &lt;code&gt;grep&lt;/code&gt;, you ask. Well, I actually just went to google that up😅. &lt;code&gt;Global Regular Expression Print&lt;/code&gt;. Basically, it looks for files  or text that match the particular pattern given. Say &lt;code&gt;grep "hello"&lt;/code&gt; will look for texts that contain 'hello'&lt;/p&gt;

&lt;p&gt;But that's not even the problem. What annoyed me was, yes it would list all files that match a pattern, but what I really needed was WHERE the file is. Grep didn't give me that, or at least I didn't know how to ask nicely.&lt;/p&gt;

&lt;h3&gt;
  
  
  FIND the savior
&lt;/h3&gt;

&lt;p&gt;In walks &lt;code&gt;FIND&lt;/code&gt;. I could never ask for more😂🤩.&lt;br&gt;
This is the heart of our discourse today.&lt;br&gt;
Suppose you want to find a FILE with size 100 bytes, and an owner silas, I could imagine your head spinning already.&lt;/p&gt;

&lt;p&gt;But for our Swiss Army knife:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;**find . -type f -size 100c -user silas**&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let me leave you marvel at the wonders of Bourne Again SHell!! I go away smiling... a happier man.&lt;/p&gt;

&lt;p&gt;But before I go, check out the &lt;a href="https://overthewire.org/wargames/bandit/" rel="noopener noreferrer"&gt;game&lt;/a&gt; I mentioned earlier.&lt;/p&gt;

&lt;p&gt;Bye👋🏻&lt;/p&gt;

</description>
      <category>bash</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Write Git Commit Messages Like a Pro</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Wed, 11 Feb 2026 01:34:24 +0000</pubDate>
      <link>https://dev.to/silaslelei/how-to-write-git-commit-messages-like-a-pro-3ep4</link>
      <guid>https://dev.to/silaslelei/how-to-write-git-commit-messages-like-a-pro-3ep4</guid>
      <description>&lt;p&gt;Ever wondered how to write commit messages for Git? Or maybe you’ve written messages that were technically correct but still caused murmurs in your team?&lt;/p&gt;

&lt;p&gt;Well, that ends here and now. We’ve all been victims of this anomaly, and the way forward is simple: improve ourselves and share knowledge.&lt;br&gt;
Let's dive in...&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Git?
&lt;/h3&gt;

&lt;p&gt;Git is a distributed version control system that manages versions of source code or data. Programmers often use it to collaborate on projects efficiently.&lt;/p&gt;

&lt;p&gt;Git lets you work locally, track changes to files, and push those changes to remote repositories like GitHub or Bitbucket for collaboration. &lt;br&gt;
&lt;a href="https://en.wikipedia.org/wiki/Git" rel="noopener noreferrer"&gt;More about git&lt;/a&gt;&lt;br&gt;
&lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git official&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to commit
&lt;/h3&gt;

&lt;p&gt;A commit is made by running &lt;code&gt;git commit -m "some-message"&lt;/code&gt; with -m flag denoting &lt;em&gt;message&lt;/em&gt; and "some-message" being the details of what you are committing, which is the main point of our article today.&lt;/p&gt;

&lt;p&gt;Commit messages aren’t about long paragraphs, perfect grammar, or capitalization. They are about clarity, brevity, and readability. &lt;/p&gt;

&lt;h3&gt;
  
  
  Common Commit Message Tags
&lt;/h3&gt;

&lt;p&gt;Using standard tags makes Git history clear and helps your team understand the purpose of each change.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;feat&lt;/code&gt;:&lt;br&gt;
when the commit adds or changes functionality in a way that matters to users e.g &lt;code&gt;feat: add GitHub OAuth login&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;fix&lt;/code&gt;:&lt;br&gt;
when the commit fixes a bug that existed e.g &lt;code&gt;fix: handle API rate limits&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;docs&lt;/code&gt;:&lt;br&gt;
when only the documentation changes (no code behavior changes). e.g &lt;code&gt;docs: update README with setup instructions&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;style&lt;/code&gt;:&lt;br&gt;
Code style or formatting changes that do not affect logic or behavior. e.g &lt;code&gt;style: fix indentation&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;refactor&lt;/code&gt;:&lt;br&gt;
Code changes that improve structure or readability without changing behavior. e.g &lt;code&gt;refactor: simplify GitHub client logic&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;test&lt;/code&gt;:&lt;br&gt;
Adds, updates, or fixes tests only. e.g &lt;code&gt;test: add unit tests for login&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;chore&lt;/code&gt;:&lt;br&gt;
Maintenance tasks that don’t affect application behavior&lt;br&gt;
(dependencies, configs, scripts). e.g &lt;code&gt;chore: update GitHub Actions workflow&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;revert&lt;/code&gt;:&lt;br&gt;
Reverts a previous commit e.g &lt;code&gt;revert: undo login feature&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;perf&lt;/code&gt;:&lt;br&gt;
Changes that improve performance e.g &lt;code&gt;perf: optimize database queries&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;build&lt;/code&gt;:&lt;br&gt;
Changes that affect the build system or external dependencies. e.g &lt;code&gt;build: update dependencies&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is also good practice to write your commits in the present tense. Instead of "feat: added login functionality", do "feat: add login functionality" &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"That's how dad did it, that's how America does it, and it's worked out pretty well so far"&lt;br&gt;
 ~Iron Man 2008&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This sets the base for linear and standard collaboration works and i hope you are a better commiter now that you've come this far.&lt;/p&gt;

&lt;p&gt;Like my boss would say, leave with a quote to appear smart, i will leave you with this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Git commit messages are how we communicate to our future selves."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Happy committing, and may your Git history be forever clean and understandable.&lt;/p&gt;

&lt;p&gt;Bye 👋&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>git</category>
      <category>programming</category>
    </item>
    <item>
      <title>Survival Mode: Week 1 at Zone01 Kisumu ✅</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Tue, 20 Jan 2026 05:44:28 +0000</pubDate>
      <link>https://dev.to/silaslelei/survival-mode-week-1-at-zone01-kisumu-3pd8</link>
      <guid>https://dev.to/silaslelei/survival-mode-week-1-at-zone01-kisumu-3pd8</guid>
      <description>&lt;p&gt;The first week is officially in the books. To say it was a "challenge" would be an understatement—it was a full-on baptism by fire.&lt;/p&gt;

&lt;p&gt;If there was ever a moment to throw in the towel, this was it. The learning curve was vertical, the bugs were relentless, and the caffeine was mandatory. But we made it through. We might have a few "mental bruises" and syntax-induced scars, but we’re still standing.&lt;/p&gt;

&lt;p&gt;I’m finally starting to find my rhythm at Zone01 Kisumu. The road ahead looks intense, but if Week 1 taught me anything, it's that the grind is where the growth happens.&lt;/p&gt;

&lt;p&gt;Keep it locked. 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Sabbatical... 😂</title>
      <dc:creator>Silas</dc:creator>
      <pubDate>Sat, 17 Jan 2026 13:36:05 +0000</pubDate>
      <link>https://dev.to/silaslelei/sabbatical-2h4b</link>
      <guid>https://dev.to/silaslelei/sabbatical-2h4b</guid>
      <description>&lt;p&gt;So yesterday, I wrote a test on golang after about 300 days of not touching code. &lt;br&gt;
I was very confident about acing the test and I had nothing to worry about. &lt;br&gt;
Well... 😂&lt;br&gt;
Let's just say, iron rusts when left outside. &lt;br&gt;
Dust accumulates when stuff is undisturbed. &lt;/p&gt;

&lt;p&gt;So here I am, back again, to writing code. May the codes be with me... And y'all 💪&lt;/p&gt;

</description>
      <category>go</category>
      <category>zone01kisumu</category>
    </item>
  </channel>
</rss>
