<?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>Forem: Adetola Esther</title>
    <description>The latest articles on Forem by Adetola Esther (@adetolaesther).</description>
    <link>https://forem.com/adetolaesther</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%2F2585419%2F4c44abd9-7224-4676-b61b-129787412327.png</url>
      <title>Forem: Adetola Esther</title>
      <link>https://forem.com/adetolaesther</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adetolaesther"/>
    <language>en</language>
    <item>
      <title>A Beginner’s Guide to ThreeJs</title>
      <dc:creator>Adetola Esther</dc:creator>
      <pubDate>Fri, 13 Feb 2026 11:10:13 +0000</pubDate>
      <link>https://forem.com/adetolaesther/a-beginners-guide-to-threejs-ob5</link>
      <guid>https://forem.com/adetolaesther/a-beginners-guide-to-threejs-ob5</guid>
      <description>&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%2F4qdmnqxhtflnlep6qjr3.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%2F4qdmnqxhtflnlep6qjr3.png" alt=" " width="310" height="162"&gt;&lt;/a&gt;Sometime ago,I was told me that no matter what you’re learning in tech whether it’s a new method, a new language, a new framework, or a new tool you can always approach it by asking three questions: What does it take? What does it return? And what does it do?&lt;/p&gt;

&lt;p&gt;Unfortunately, with Three.js, this is the first time that approach has completely failed me, After three trails however, I'm writing this as an intro to threejs for those that are struggling with it just like me.&lt;/p&gt;

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

&lt;p&gt;Three.js is a high-level JavaScript library for creating 3D graphics in web browsers. It simply simplifies 3D creation and animation without any WebGL code knowledge.&lt;/p&gt;

&lt;p&gt;To render 3D graphics in a browser, we need the help of the GPU(Graphic processing unit)the part of your computer that’s really good at drawing graphics.&lt;br&gt;
WebGL is the tool that lets JavaScript talk to the GPU. It acts like a translator, helping the browser tell the GPU what to render on the screen. &lt;br&gt;
Threejs is built on top of webgl, it abstracts the complicated webGL language into an easy to use javascript Api so we reallyy don't have to bother again that.&lt;br&gt;
To understand or use Three.js, it’s important to know that everything is built around three core objects. These three objects form the foundation of the Three.js workflow:&lt;br&gt;
    1.  Scene&lt;br&gt;
    2.  Camera&lt;br&gt;
    3.  Renderer&lt;br&gt;
In this tutorial, we’ll explore these three core concepts while building something small along the way. This hands on approach will help make each concept easier to understand as we go but before we begin, the first step is installation by running this in our terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# three.js
npm install --save three

# vite
npm install --save-dev vite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.Scene
&lt;/h2&gt;

&lt;p&gt;A scene in Three.js can be thought of as the world where everything exists. It contains everything you want to see(objects, lights, and anything else that should appear on the screen).&lt;br&gt;
A good way to think about a scene is like a movie set. The set holds all the props, actors, and lights. Without the set, there’s nothing to film.&lt;br&gt;
In the same way, before we can display anything with Three.js, we must first create a scene. Every visible object in Three.js lives inside a scene&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as THREE from 'three';

const scene = new THREE.Scene();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it.&lt;br&gt;
At this point, we've created an empty world. Nothing will show on the screen yet because the scene has no objects,no camera and nothing is being rendered So we need the camera.&lt;/p&gt;
&lt;h2&gt;
  
  
  2.Camera
&lt;/h2&gt;

&lt;p&gt;The camera is the viewer's eye. It is used to look at everything inside the scene. on our movie set, the camera is literally the cameraman. And there are multiple camera types. Three.js provides several types of cameras, including:&lt;br&gt;
    • PerspectiveCamera&lt;br&gt;
    • OrthographicCamera&lt;br&gt;
    • CubeCamera&lt;br&gt;
    • ArrayCamera&lt;br&gt;
    • StereoCamera&lt;/p&gt;

&lt;p&gt;However, the most common is the PerspectiveCamera which is designed to mimic how the human eye sees the world, where objects farther away appear smaller and objects closer appear larger.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as THREE from 'three';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;a PerspectiveCamera takes 3 arguments, each controlling how the scene is viewed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Field of View (FOV)&lt;br&gt;
This controls how wide the camera can see.It is measured in degrees and usually represents the vertical viewing angle.&lt;br&gt;
A larger value means you see more of the scene, while a smaller value zooms in closer.(ours is 75)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Aspect Ratio&lt;br&gt;
This is the shape of the camera’s view and is usually based on the browser window.&lt;br&gt;
It is calculated by dividing the window’s width by its height:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;window.innerWidth / window.innerHeight

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

&lt;/div&gt;



&lt;p&gt;The last two are &lt;br&gt;
a. Near Clipping Plane&lt;br&gt;
This defines how close an object can be to the camera before it is no longer visible.&lt;/p&gt;

&lt;p&gt;b. Far Clipping Plane&lt;br&gt;
This defines how far an object can be from the camera before it disappears.&lt;/p&gt;

&lt;p&gt;Together, the near and far values create the view frustum, which determines what the camera can and cannot see.&lt;/p&gt;

&lt;p&gt;For example, using  0.1 and 1000 means everything is seen frim the camera lens.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Renderer
&lt;/h2&gt;

&lt;p&gt;The renderer is what actually draws everything on the screen. You can think of it like a painter, it takes all the objects in the scene, looks through the camera, and paints the final image onto your browser. In Three.js, the most commonly used renderer is the WebGLRenderer. When creating it, you need to tell it where to display the scene in the browser. Usually, this is done by attaching it to a DOM element, like the &lt;/p&gt; or a specific .&lt;br&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as THREE from 'three';

// Create the renderer
const renderer = new THREE.WebGLRenderer();

// Set the size of the renderer (usually the window size)
renderer.setSize(window.innerWidth, window.innerHeight);

// Add the renderer to the HTML document
document.body.appendChild(renderer.domElement);
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Now that we have a scene, a camera, and a renderer, let’s add a 3D object. In Three.js, creating an object happens in three main steps&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Create the geometry
&lt;/h2&gt;

&lt;p&gt;The geometry defines the shape of our object. It’s basically the XYZ points that make up the object in 3D space.&lt;/p&gt;

&lt;p&gt;Three.js has a bunch of built-in geometries, like cubes, spheres, cones, and planes that can be seen in the docs. For this tutorial, we’ll use a sphere:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const geometry = new THREE.SphereGeometry(15, 32, 16);

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



&lt;p&gt;15 is the radius of the sphere&lt;/p&gt;

&lt;p&gt;32 is the number of horizontal segments&lt;/p&gt;

&lt;p&gt;16 is the number of vertical segments&lt;/p&gt;

&lt;p&gt;This gives us a smooth-looking sphere.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2. Create the material

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



&lt;p&gt;The material defines how the geometry looks. we can think of it as the wrapping paper for your 3D shape.&lt;/p&gt;

&lt;p&gt;Three.js has many materials that can aslo been seen in their docs. Some respond to light (like MeshStandardMaterial), while others don’t. For simplicity, we’ll use MeshBasicMaterial, which does not rely on lights:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const material = new THREE.MeshBasicMaterial({
  color: 0xf9a8d4,
  wireframe: true,
});

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



&lt;p&gt;color: sets the color of the sphere&lt;/p&gt;

&lt;p&gt;wireframe: true makes the sphere display as a wireframe, so you can see its structure&lt;/p&gt;

&lt;p&gt;3.Creating a mesh&lt;br&gt;
A mesh is created by combining geometry and material. The mesh is the actual object that can be added to the scene.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sphere = new THREE.Mesh(geometry, material);
sphere.position.set(8, -30, 0)
scene.add(sphere);
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Now the sphere exists in the scene, ready to be rendered.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Animate the sphere &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can make the sphere spin to make the scene more dynamic:&lt;/p&gt;

&lt;p&gt;const animate = () =&amp;gt; {&lt;br&gt;
    requestAnimationFrame(animate);&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sphere.rotation.x += 0.01;
sphere.rotation.y += 0.005;
sphere.rotation.z += 0.01;

renderer.render(scene, camera);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;animate();&lt;/p&gt;

&lt;p&gt;At this point, you have a 3D animated sphere rotating on your screen! Of course, there’s much more to Three.js than just this. It’s used in interactive websites, games, simulations, and a whole lot more but if you’ve struggled with Three.js like I have, congratulations, you’ve just created your first 3D object. From here, you can, Add lights to your scene, Experiment with materials, colors, and geometries and Play around with what you’ve built and see how changes affect your scene.&lt;/p&gt;

&lt;p&gt;Also, check out the examples in the official &lt;a href="https://threejs.org/docs/" rel="noopener noreferrer"&gt;Three.js documentation &lt;/a&gt;they’re a great source of inspiration and learning and maybe once I’ve mastered Three.js, I’ll come back with a more detailed tutorialand this time, we might build something even more exciting.&lt;/p&gt;

</description>
      <category>threejs</category>
      <category>animation</category>
    </item>
    <item>
      <title>Some cool Web APIs</title>
      <dc:creator>Adetola Esther</dc:creator>
      <pubDate>Tue, 28 Oct 2025 07:48:34 +0000</pubDate>
      <link>https://forem.com/adetolaesther/some-cool-web-apis-20m2</link>
      <guid>https://forem.com/adetolaesther/some-cool-web-apis-20m2</guid>
      <description>&lt;p&gt;Last week, I decided to switch up how I learn. Instead of just reading tutorials and documentation, I tried something simple, asking three core questions about every new concept I came across, a technique recommended by my mentor.&lt;/p&gt;

&lt;p&gt;Those three questions were:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What does it do? (What’s its purpose or behavior?)&lt;/li&gt;
&lt;li&gt;What does it take? (What inputs, dependencies, or setup does it require?)&lt;/li&gt;
&lt;li&gt;What does it return? (What’s the output or result you can expect?)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This technique forces clarity and Using this approach, here’s what I explored last week.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Interception Observer
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What does it do?
&lt;/h2&gt;

&lt;p&gt;interception Observer is used to detect interaction between the target element and its ancestor element. It is used to detect if some elements are visible at viewports or not. &lt;br&gt;
 It provides an efficient way to track visibility changes without constantly listening to scroll or resize events.&lt;/p&gt;
&lt;h2&gt;
  
  
  What does it take?
&lt;/h2&gt;

&lt;p&gt;An Intersection Observer takes two main inputs:&lt;/p&gt;

&lt;p&gt;1) A callback function &lt;br&gt;
 This function is triggered whenever the visibility of the observed element changes. It receives a list of IntersectionObserverEntry objects, which contain information about each observed target.&lt;br&gt;
 If an entry’s isIntersecting property is true, it means the target element is visible within the viewport or within the specified root element.&lt;/p&gt;

&lt;p&gt;2) An options object &lt;br&gt;
This object can include the following properties:&lt;br&gt;
 a) root: Defines the element that is used as the viewport for checking the visibility of the target. It must be an ancestor of the target element. If not specified, the browser’s viewport is used by default.&lt;br&gt;
 b) threshold (sometimes misheard or mistyped as choiceOde): Can be a single number or an array of numbers between 0 and 1. It specifies how much of the target element must be visible before the callback is triggered.&lt;br&gt;
Example: 0.5 means the callback fires when half of the element is visible; 1 means the callback fires only when the entire element is visible. The default value is 0.&lt;br&gt;
c) rootMargin: Works similarly to CSS margins. It accepts one to four values (margin-top, margin-right, margin-bottom, margin-left) and can be used to expand or shrink the root’s bounding box. For example, "0px 0px -50px 0px" can trigger earlier or later than the actual visibility point.&lt;/p&gt;
&lt;h2&gt;
  
  
  What does it return?
&lt;/h2&gt;

&lt;p&gt;It returns an observer object that provides methods such as  .observe() and .unobserve(), allowing you to start or stop observing specific target elements for visibility changes.&lt;/p&gt;
&lt;h2&gt;
  
  
  When to use Intersection Observer
&lt;/h2&gt;

&lt;p&gt;Intersection Observers are useful in many real world web interactions, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lazy loading images – Only load images when they’re about to appear on the screen.&lt;/li&gt;
&lt;li&gt;Detecting visibility – Check whether a specific element is within the viewport.&lt;/li&gt;
&lt;li&gt;Autoplay or pause media – Automatically play a video when visible and pause when it scrolls out of view.&lt;/li&gt;
&lt;li&gt;Infinite scrolling – Load more content when the user reaches the end of a page or list.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2.createElement()
&lt;/h2&gt;
&lt;h2&gt;
  
  
  What does it do?
&lt;/h2&gt;

&lt;p&gt;In an HTML document, the &lt;code&gt;document.createElement()&lt;/code&gt; method is used to dynamically create new HTML elements using JavaScript. Instead of hardcoding everything inside your HTML file, this method lets you generate elements on the fly and attach them to the DOM. JavaScript dynamically builds and updates the interface by creating, modifying, and removing elements without reloading the page.&lt;br&gt;
 This makes the web app more efficient and interactive, as it allows constructing UI components directly with JavaScript rather than writing repetitive static HTML.&lt;/p&gt;
&lt;h2&gt;
  
  
  What does it take?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;createElement()&lt;/code&gt; method takes one argument, a string representing the tag name of the element you want to create.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const button = document.createElement('button');

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

&lt;/div&gt;



&lt;p&gt;Here, a  element is created in memory but not yet added to the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it return?
&lt;/h2&gt;

&lt;p&gt;the new element.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.Canva API
&lt;/h2&gt;

&lt;p&gt;The Canvas API provides a means for drawing graphics via JavaScript and the HTML &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element. Among other things, it can be used for animation, game graphics, data visualization, photo manipulation, and real-time video processing.&lt;/p&gt;

&lt;p&gt;The Canvas API largely focuses on 2D graphics allowing developers to create visual elements dynamically including animations, charts, game graphics, image effects, and even real-time video processing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it take?
&lt;/h2&gt;

&lt;p&gt;To use the Canvas API, you typically need:&lt;br&gt;
a) An HTML  element: This defines the drawing area in your document. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;canvas id="myCanvas" width="400" height="400"&amp;gt;&amp;lt;/canvas&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;b) A rendering context &lt;br&gt;
In JavaScript, you access the drawing functions by retrieving the context&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const canvas = document.getElementById('myCanvas');&lt;br&gt;
const ctx = canvas.getContext('2d');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The getContext('2d') method gives you the 2D drawing context, which contains all the methods needed to draw shapes, text, images, and more.&lt;/p&gt;

&lt;p&gt;c) Drawing instructions &lt;br&gt;
Once you have the context, you can call methods like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ctx.fillRect(x, y, width, height) – Draws a filled rectangle.&lt;/li&gt;
&lt;li&gt;ctx.beginPath() and ctx.lineTo() – Used to create complex paths and shapes.&lt;/li&gt;
&lt;li&gt;ctx.drawImage() – Renders images or videos onto the canvas.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  What does it return?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Channel Messaging API&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  What does it do?
&lt;/h2&gt;

&lt;p&gt;The Channel Messaging API allows two separate scripts running in different browsing contexts (such as two iframes or an iframe and its parent document) to communicate directly with each other.&lt;br&gt;
It creates a two-way communication channel, where each side can send and receive messages asynchronously through dedicated message ports. &lt;br&gt;
 This makes it useful for scenarios where web components, embedded widgets, or isolated scripts need to share data safely and efficiently without relying on global variables or storage.&lt;/p&gt;
&lt;h2&gt;
  
  
  What does it take?
&lt;/h2&gt;

&lt;p&gt;A message channel is created using the &lt;code&gt;MessageChannel()&lt;/code&gt; constructor. Once created, the two ends of the channel can be accessed through: &lt;code&gt;MessageChannel.port1&lt;/code&gt; and &lt;code&gt;MessageChannel.port2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The context that creates the channel uses port1, while the second context (such as an iframe) uses port2.&lt;/p&gt;

&lt;p&gt;You can send messages through &lt;code&gt;port2.postMessage()&lt;/code&gt; and transfer the port itself to another browsing context using window.postMessage() along with two arguments(the message to send, the object to transfer ownership of)&lt;br&gt;
The receiving context listens for messages using &lt;code&gt;onmessage&lt;/code&gt;, and grabs the message content from event's data.&lt;br&gt;
To reply, it can use its own &lt;code&gt;MessagePort.postMessage()&lt;/code&gt; method.&lt;br&gt;
When communication is no longer needed, &lt;code&gt;MessagePort.close()&lt;/code&gt; can be called to close the connection on both ends.&lt;/p&gt;
&lt;h2&gt;
  
  
  What does it return?
&lt;/h2&gt;

&lt;p&gt;a communication bridge&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Geolocation API&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  What does it do?
&lt;/h2&gt;

&lt;p&gt;The Geolocation API allows users to share their physical location with web applications if they choose to.&lt;br&gt;
For privacy and security reasons, the browser always asks for the user’s permission before sharing any location data. Once granted, the API enables a web app to access the device’s geographic position, using the best available method (such as GPS, Wi-Fi, or network information).&lt;/p&gt;

&lt;p&gt;For browser extensions, any feature that accesses geolocation data must explicitly declare the "geolocation" permission in the manifest file.&lt;/p&gt;
&lt;h2&gt;
  
  
  What does it take?
&lt;/h2&gt;

&lt;p&gt;The Geolocation API takes:&lt;/p&gt;

&lt;p&gt;1 User permission &lt;br&gt;
 The browser automatically prompts the user to grant or deny location access before the API can return any data.&lt;br&gt;
2 Callback functions &lt;br&gt;
 The API works asynchronously and requires callback functions to handle success or error responses.&lt;/p&gt;

&lt;p&gt;The Geolocation API is accessed via a call to navigator.geolocation; this will cause the user's browser to ask them for permission to access their location data. If they accept, then the browser will use the best available functionality on the device to access this information. Developer can now access this location information in a couple of different ways:&lt;/p&gt;

&lt;p&gt;a) &lt;code&gt;Geolocation.getCurrentPosition()&lt;/code&gt;: Retrieves the device's current location.&lt;br&gt;
b) &lt;code&gt;Geolocation.watchPosition()&lt;/code&gt;: Registers a handler function that will be called automatically each time the position of the device changes, returning the updated location.&lt;/p&gt;

&lt;p&gt;Each of these methods can take up to three arguments:&lt;br&gt;
1 A success callback (required) executed when location retrieval succeeds. It receives a &lt;code&gt;GeolocationPosition&lt;/code&gt; object containing data such as latitude, longitude, and accuracy.&lt;br&gt;
2 An error callback (optional)  executed if retrieval fails. It receives a &lt;code&gt;GeolocationPositionError&lt;/code&gt; object explaining what went wrong (e.g., permission denied, timeout, or unavailable data).&lt;br&gt;
3 An options object (optional) that allows developers to configure retrieval settings such as accuracy, timeout, and caching behavior.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;navigator.geolocation.getCurrentPosition(
  (position) =&amp;gt; {
    console.log(position.coords.latitude, position.coords.longitude);
  },
  (error) =&amp;gt; {
    console.error(error);
  },
  { enableHighAccuracy: true, timeout: 5000 }
);

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  What does it return?
&lt;/h2&gt;

&lt;p&gt;The Geolocation API returns a Geolocation object, which provides access to the methods and properties needed to retrieve and monitor location data.&lt;br&gt;
When successfully executed, it provides a GeolocationPosition object containing detailed information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;coords.latitude&lt;/li&gt;
&lt;li&gt;coords.longitude&lt;/li&gt;
&lt;li&gt;coords.accuracy&lt;/li&gt;
&lt;li&gt;timestamp&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When to use Geolocation API
&lt;/h2&gt;

&lt;p&gt;Geolocation API can be useful when building&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Weather apps&lt;/li&gt;
&lt;li&gt;Maps and navigation&lt;/li&gt;
&lt;li&gt;Ride-hailing or delivery apps&lt;/li&gt;
&lt;li&gt;Logistics and fleet management &lt;/li&gt;
&lt;li&gt;Fitness and outdoor activity apps &lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Storage API&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What does it do?
&lt;/h2&gt;

&lt;p&gt;The Storage API provides a way for web applications to store data locally on a user’s device directly in the browser so that information can persist between sessions without needing a server connection.&lt;br&gt;
It allows developers to save key value data, user preferences, and small amounts of application state, making websites faster and more interactive even when offline.&lt;br&gt;
There are two main parts of the Storage API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;localStorage – Stores data permanently (until explicitly cleared by the user or the site).&lt;/li&gt;
&lt;li&gt;sessionStorage – Stores data temporarily for a single session (it’s cleared once the browser tab is closed).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What does it take?
&lt;/h2&gt;

&lt;p&gt;The Storage API takes: A key and a value. Data is stored in key value pairs, where both are strings.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;localStorage.setItem('username', 'Adetola');&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Here, 'username' is the key, and 'Adetola' is the value being stored.&lt;/p&gt;

&lt;p&gt;A key (for retrieval or removal) – &lt;br&gt;
To read stored data:&lt;br&gt;
&lt;code&gt;const name = localStorage.getItem('username');&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
To remove data:&lt;br&gt;
&lt;code&gt;localStorage.removeItem('username');&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Or to clear everything at once:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;localStorage.clear();&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What does it return?
&lt;/h2&gt;

&lt;p&gt;The Storage API itself returns a Storage object, which provides methods (setItem(), getItem(), removeItem(), clear()) for interacting with stored data.&lt;/p&gt;

&lt;p&gt;When data is retrieved using getItem(), it returns the string value associated with the specified key. If the key doesn’t exist, it returns null.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href="https://www.geeksforgeeks.org/javascript/introduction-to-intersection-observer/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/javascript/introduction-to-intersection-observer/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/javascript/html-dom-createelement-method/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/javascript/html-dom-createelement-method/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API/Using_channel_messaging" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API/Using_channel_messaging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>SEO and Next.js: How to Implement and Optimize for Better Results</title>
      <dc:creator>Adetola Esther</dc:creator>
      <pubDate>Tue, 28 Oct 2025 06:29:28 +0000</pubDate>
      <link>https://forem.com/adetolaesther/seo-and-nextjs-how-to-implement-and-optimize-for-better-results-54pj</link>
      <guid>https://forem.com/adetolaesther/seo-and-nextjs-how-to-implement-and-optimize-for-better-results-54pj</guid>
      <description>&lt;h2&gt;
  
  
  What is SEO?
&lt;/h2&gt;

&lt;p&gt;SEO stands for Search Engine Optimization. It is the process of making a website more visible in search results to increase both the quality and quantity of traffic. Unlike paid ads, SEO focuses on organic traffic, making websites easier for users to find naturally through search engines like Google and Bing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is SEO Important?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Organic search dominates traffic: Around 50% of website traffic comes from search engines. Unlike paid advertising which may be shown to people who aren’t actively looking. organic search happens when a user types a specific query. By ranking for those keywords, your website positions itself as the solution to their problem, leading to higher quality leads and better conversion rates.
2.Search is a daily habit: Over 8.5 billion searches happen on Google every day. Search is deeply integrated into people’s lives. Businesses without a strong organic presence risk being invisible to their audience. Since most searches now happen on mobile, Google prioritizes mobile-friendly websites. This means businesses need fast, responsive, user-friendly websites to perform well in search rankings and build a strong brand perception.&lt;/li&gt;
&lt;li&gt;It’s sustainable: Unlike paid ads that stop driving traffic once the campaign ends, SEO continues to work long term, making it a more sustainable strategy.&lt;/li&gt;
&lt;li&gt;It builds trust: Ranking high on Google is a signal of credibility. Users tend to trust organic results more than ads, so appearing at the top transfers that trust to your brand.&lt;/li&gt;
&lt;li&gt;It outperforms paid ads in the long run While ads can provide a short-term boost, SEO offers long-term visibility and trust that ads cannot match.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Implementing SEO in Next.js
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Metadata Management
The easiest way to start with SEO is by managing your Html metadata using the next/head document. Metadata is like your page title and description, is crucial for SEO. It's the first thing search engines see and what appears in search results. Next.js provides a straightforward way to handle this using the metadata object or the generateMetadata function (for App Router) or the next/head component (for Pages Router).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Static Metadata: For pages with content that doesn't change, you can define a static metadata object. This is ideal for things like your homepage, "about us" page, or a static landing page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; import type { Metadata } from 'next'

 export const metadata: Metadata = {
   title: 'My Awesome Website',
   description: 'The best website for all your needs.',
 }

 export default function Page() {
   //...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dynamic Metadata: For dynamic pages, like blog posts or product pages, you'll need to generate metadata based on the content. The generateMetadata function allows you to fetch data and use it to create unique titles and descriptions for each page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import type { Metadata, ResolvingMetadata } from 'next'

type Props = {
  params: { slug: string }
}

export async function generateMetadata(
  { params }: Props,
  parent: ResolvingMetadata
): Promise&amp;lt;Metadata&amp;gt; {
  // Fetch data for the specific blog post
  const post = await fetch(`https://.../posts/${params.slug}`).then((res) =&amp;gt; res.json())

  return {
    title: post.title,
    description: post.description,
  }
}

export default function Page({ params }: Props) {
  //...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Optimizing SEO in Next.js
&lt;/h2&gt;

&lt;p&gt;SEO in Next.js goes beyond metadata—it’s about leveraging the framework’s built-in features for speed, crawlability, and user experience.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rendering Strategies
Choosing the right rendering method is crucial for SEO:&lt;/li&gt;
&lt;li&gt;Static Site Generation (SSG): Pages are pre-rendered at build time into static HTML. This makes them fast-loading and ideal for content that doesn’t change often (e.g., landing pages).&lt;/li&gt;
&lt;li&gt;Server-Side Rendering (SSR): Pages are rendered on the server for each request. This is best for highly dynamic, user-specific content, like a product inventory or a profile page. The advantage is that crawlers still see the complete HTML.&lt;/li&gt;
&lt;li&gt;Incremental Static Regeneration (ISR): A hybrid approach that combines SSG and SSR. Pages are generated statically but can be updated at intervals or when data changes. This offers both speed and freshness.&lt;/li&gt;
&lt;li&gt;Image and Font Optimization
Page speed is a major SEO factor, and Next.js helps here:&lt;/li&gt;
&lt;li&gt;Automatic image optimization (resizing images based on device and lazy-loading them only when they appear in view).&lt;/li&gt;
&lt;li&gt;Built-in font optimization, reducing load time and improving Core Web Vitals.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Server-Side Rendering (SSR)
&lt;/h2&gt;

&lt;p&gt;The delivery of content from a server to a user’s browser is a foundational challenge in web development. The architectural approach chosen directly shapes performance, user experience, and business outcomes.&lt;br&gt;
For a while now, the debate has centered on two core strategies: &lt;strong&gt;Server-Side Rendering (SSR)&lt;/strong&gt; and &lt;strong&gt;Client-Side Rendering (CSR)&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSR generates a complete HTML page on the server and delivers it ready for immediate display in the browser.&lt;/li&gt;
&lt;li&gt;CSR, by contrast, sends a minimal HTML shell and relies on JavaScript in the browser to construct the page.
At their core, these strategies represent a fundamental trade-off: should the computational workload be centralized on the server or distributed across user devices?
In this section, we’ll focus on SSR.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is SSR?
&lt;/h2&gt;

&lt;p&gt;Server-Side Rendering (SSR) is a technique where a web page’s HTML is generated on the server in response to a user’s request.&lt;br&gt;
When a user navigates to a URL:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The server processes the request.&lt;/li&gt;
&lt;li&gt;It fetches any required data.&lt;/li&gt;
&lt;li&gt;It generates a complete HTML document.&lt;/li&gt;
&lt;li&gt;That document is sent to the browser, which can immediately display the content.
This is different from CSR, where the server sends a lightweight HTML shell and relies on JavaScript running in the browser to fetch data, construct the DOM, and render the final page.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why Do You Need SSR?
&lt;/h2&gt;

&lt;p&gt;SSR solves several common challenges in modern web development:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Faster First Paint / Initial Load Since the browser receives a fully rendered page, users can see meaningful content almost immediately.&lt;/li&gt;
&lt;li&gt;Improved SEO Search engine crawlers can index SSR pages more effectively because the content is present in the initial HTML, not hidden behind JavaScript execution.&lt;/li&gt;
&lt;li&gt;Consistent User Experience Across Devices SSR reduces reliance on client-side processing power. This makes it ideal for users on older devices or slower networks, where heavy JavaScript rendering would otherwise cause delays.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  When to Use SSR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Content-heavy sites that need SEO (e.g., blogs, e-commerce stores, news sites).&lt;/li&gt;
&lt;li&gt;Applications targeting a global audience where device performance and network speed vary.&lt;/li&gt;
&lt;li&gt;Pages requiring fast initial load times to reduce bounce rates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When Not to Use SSR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Highly interactive, dynamic applications (e.g., dashboards, single-page apps) where most of the content changes after the page loads.&lt;/li&gt;
&lt;li&gt;Applications with real-time updates (e.g., stock tickers, chat apps) that rely heavily on client-side rendering anyway.&lt;/li&gt;
&lt;li&gt;Projects with limited server resources, since SSR increases server workload.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pros of SSR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Faster initial page load and first contentful paint&lt;/li&gt;
&lt;li&gt;Better SEO since crawlers see pre-rendered HTML&lt;/li&gt;
&lt;li&gt;Consistent experience across devices&lt;/li&gt;
&lt;li&gt;Good for static or semi-static content with high visibility needs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cons of SSR
&lt;/h2&gt;

&lt;p&gt;Heavier load on the server, which can affect scalability &lt;br&gt;
Slower page transitions (compared to CSR) since each navigation triggers a new server request  &lt;br&gt;
Increased complexity when integrating with client-side interactivity Caching and performance optimization can be more challenging&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>nextjs</category>
      <category>tutorial</category>
      <category>performance</category>
    </item>
    <item>
      <title>Accessibility.</title>
      <dc:creator>Adetola Esther</dc:creator>
      <pubDate>Mon, 28 Jul 2025 09:22:59 +0000</pubDate>
      <link>https://forem.com/adetolaesther/accessibility-1913</link>
      <guid>https://forem.com/adetolaesther/accessibility-1913</guid>
      <description>&lt;h2&gt;
  
  
  What is accessibility?
&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%2Fjlz035c7qsrod3iqkky0.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%2Fjlz035c7qsrod3iqkky0.png" alt=" " width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Accessibility is the practice of making your app or website accessible to everyone regardless of their ability or disability. It is often referred to as A11y(as in, 'a', then 11 characters, and then 'y'). It can be seen as treating everyone the same, and giving them equal opportunities, no matter what their ability or circumstances. &lt;/p&gt;

&lt;h2&gt;
  
  
  What type of disabilities are we looking at?
&lt;/h2&gt;

&lt;p&gt;1) People with visual impairments &lt;br&gt;
  This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Blindness&lt;/li&gt;
&lt;li&gt;Low vision&lt;/li&gt;
&lt;li&gt;Color blindness&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many visually impaired users rely on screen readers, which convert digital text into speech, or screen magnifiers. Designers and developers should ensure that all visual elements are also accessible through text, proper HTML semantics, and ARIA labels.&lt;/p&gt;

&lt;p&gt;2) people with hearing impairments &lt;br&gt;
This includes individuals with hearing loss ranging from mild to profound&lt;br&gt;
To make content accessible to them,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Videos should be captioned&lt;/li&gt;
&lt;li&gt;Audio should come with transcripts&lt;/li&gt;
&lt;li&gt;Textual alternatives should be provided for sound-based interactions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3) people with mobility impairments &lt;br&gt;
This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Paralysis or loss of limb function&lt;/li&gt;
&lt;li&gt;Neurological disorders affecting control&lt;/li&gt;
&lt;li&gt;Age-related movement limitations
Such users may not use a mouse. They might navigate entirely with a keyboard, voice control, or adaptive switches. Therefore, all functionality should be operable using a keyboard alone.
The Web Content Accessibility Guidelines (WCAG) were developed by the World Wide Web Consortium (W3C) to standardize accessibility. These guidelines are organized around four core principles, known by the acronym POUR.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Perceivable
&lt;/h2&gt;

&lt;p&gt;Users must be able to perceive the content, regardless of how they interact with it.&lt;br&gt;
Best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide text alternatives (alt) for images&lt;/li&gt;
&lt;li&gt;Use captions and transcripts for media&lt;/li&gt;
&lt;li&gt;Ensure sufficient color contrast&lt;/li&gt;
&lt;li&gt;Structure content with proper headings&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Operable
&lt;/h2&gt;

&lt;p&gt;Users must be able to interact with and control the interface.&lt;br&gt;
Best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All functionality should be accessible via keyboard&lt;/li&gt;
&lt;li&gt;Allow users to pause or disable animations&lt;/li&gt;
&lt;li&gt;Avoid flashing content that could trigger seizures&lt;/li&gt;
&lt;li&gt;Provide clear navigation and focus indicators&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Understandable
&lt;/h2&gt;

&lt;p&gt;Content and operation should be easy to comprehend.&lt;br&gt;
Best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use plain, simple language&lt;/li&gt;
&lt;li&gt;Make navigation consistent across pages&lt;/li&gt;
&lt;li&gt;Label all forms clearly&lt;/li&gt;
&lt;li&gt;Identify input errors and offer suggestions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Robust
&lt;/h2&gt;

&lt;p&gt;Content must be usable with a wide range of technologies, including assistive tools.&lt;/p&gt;

&lt;p&gt;Best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use semantic HTML elements &lt;code&gt;&amp;lt;button&amp;gt; &amp;lt;nav&amp;gt; &amp;lt;header&amp;gt;&lt;/code&gt; etc.&lt;/li&gt;
&lt;li&gt;Add ARIA roles and states where necessary&lt;/li&gt;
&lt;li&gt;Ensure compatibility with screen readers and assistive browsers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Implement Accessibility in Your Projects
&lt;/h2&gt;

&lt;p&gt;Accessibility is the right thing to do as building accessible sites benefits everyone. A common accessibility myth is that accessibility is an expensive "added extra" to implement on a project.These are some practical suggestions you can take to make your website or app more accessible&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Start with Semantic HTML
&lt;/h2&gt;

&lt;p&gt;Use the correct HTML elements for structure and meaning. &lt;br&gt;
For example:&lt;br&gt;
Use &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; for buttons, not &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;&lt;br&gt;
Use &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; elements properly linked to form inputs&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Caption and Transcribe All Media
&lt;/h2&gt;

&lt;p&gt;Don’t rely on auto-generated captions. Always provide human-reviewed captions and transcripts for audio or video content.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.Navigation
&lt;/h2&gt;

&lt;p&gt;Presenting menus as structured lists gives assistive technologies the context they need to help users navigate. It also improves responsiveness on various devices and screen sizes. &lt;br&gt;
Practice includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Placing your menu in a consistent location across all pages&lt;/li&gt;
&lt;li&gt;Use HTML or ARIA to highlight the active/selected item&lt;/li&gt;
&lt;li&gt;Label menus clearly for easy understanding&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Order and Grouping
&lt;/h2&gt;

&lt;p&gt;Grouping related items enhances navigation and helps screen readers communicate structure and progress clearly.&lt;br&gt;
Practice includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use unordered lists &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;for menus or items where order doesn’t matter&lt;/li&gt;
&lt;li&gt;Use ordered lists &lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt; where sequence is important (e.g. steps in a process&lt;/li&gt;
&lt;li&gt;Make sure only &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; elements are children of your lists&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Color Contrast
&lt;/h2&gt;

&lt;p&gt;Color contrast ensures that text and interactive elements are legible, even for users with low vision or color blindness. Text and background contrast should be at least 4.5:1 and Essential UI icons should have a contrast ratio of at least 3:1&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Git as an onion</title>
      <dc:creator>Adetola Esther</dc:creator>
      <pubDate>Mon, 16 Jun 2025 10:16:10 +0000</pubDate>
      <link>https://forem.com/adetolaesther/git-as-an-onion-279</link>
      <guid>https://forem.com/adetolaesther/git-as-an-onion-279</guid>
      <description>&lt;p&gt;Git is an open-source version control system that allows developers to track and manage their codebase. It allows several developers to be able to work on one particular project simultaneously without interfering with each other's work. We'll be looking at Git as an onion in which we unfold each layer one by one until we get to the core which is understanding what Git really is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Git&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Git helps in tracking changes, making it possible to reverse back to the previous stage in case something goes wrong.&lt;/li&gt;
&lt;li&gt;Git allows for multiple people to be able to work on one single project at once. &lt;/li&gt;
&lt;li&gt;Git acts as storage, allowing people to share their work.
Git heavily relies on the branching system.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Branching&lt;/strong&gt;&lt;br&gt;
One of the layers of our onion is Branching.&lt;br&gt;
 Branching traditionally means diverging from the main development line. It is copying a copy of what already exists.&lt;br&gt;
A branch can also be called a pointer to a commit. The default branch is always the main branch in which other branches are then created from. Branches are mainly created for features, bugs, fixes, experiments, and so on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Branching Strategy&lt;/strong&gt;&lt;br&gt;
Branching Strategy is basically defining a set of rules to define how to work with branch. It is creating a structured workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Workflow&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Centralized Workflow &lt;br&gt;
In a centralized workflow, work is done usually in the main branch, and it is the most common branch among developers working on personal projects. This is actually not often advised as it is hard to keep track of changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Gitflow Workflow &lt;br&gt;
Gitflow Workflow, unlike centralize workflow, this involves a number of branches. There is usually the main branch, which is the stable branch and then the development branch where all the changes happen. We also have a feature branch, which is created solely for development of a particular feature, a release branch for a release, hotfix branch to fix codes already in production, and so on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Forking Workflow &lt;br&gt;
A fork is a copy of a repo a developer has worked on. A developer can make a copy of a repo(fork a repo)and then make their own changes and then push to their account without affecting the original repo. This workflow is usually used in open source projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GitHub Workflow &lt;br&gt;
GitHub Workflow compare to other workflows is lightweight and favoured by GitHub. This workflow is also created around branches and revolves around pull requests. The GitHub Workflow is the workflow in which we will be discussing more in depth in this article.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub workflow heavily operates on a pull request system. Once changes are made in a development branch, the changes are then pushed to the main branch and then this is done by creating a pull request. What the pull request does is it announces a push to a branch, allowing other collaborators to discuss, reveal changes, or even add more commits to the pull request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull Requests&lt;/strong&gt; &lt;br&gt;
A pull request is another layer of the onion. A pull request improves code quality, as it allows a review system which ensures only quality codes are pushed to production. It also allows transparency to know what changes are made and then who made them. It also allows control which makes sure that only what we want to be pushed to production are pushed. And lastly, pull request also encourages collaborations as it allows developers to review each other's codes, approve and leave comments if there is need to.&lt;/p&gt;

&lt;p&gt;A pull request is created using the Git push  command&lt;br&gt;
After a pull request has been approved, it is merged into the destination branch. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merging&lt;/strong&gt;&lt;br&gt;
After a Pull request has been reviewed and found satisfactory by the reviewer, it is then Merge into the new branch, fully allowing changes made in the feature branch to be visible also in the destination branch. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Type of merge&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Merge commit&lt;br&gt;
The default type of merge on GitHub is the merge commit. With this, a new branch is created that brings changes made in the feature branch. This contains histories of both branches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Squash and merge &lt;br&gt;
Changes made in the feature branch are squashed into a single commit before merging into the destination branch.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rebase and merge&lt;br&gt;
Using this approach, the commits from the feature branch are placed on the destination branch, and then a merge is executed. The history of the destination branch is rewritten with the new commits.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Merging vs Rebasing&lt;/strong&gt;&lt;br&gt;
Git Rebase solves the same problem as Git merge. They were both designed to integrate changes from one branch to another. This is however just done in different ways. Git Merge combines histories and creates a merge commit, while Rebase moves your commit on top of another branch, completely rewriting the history. Git Merge preserves exact commit history, while Git Rebase creates a linear and cleaner history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to Merge?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When collaborating with other developers on shared branch &lt;/li&gt;
&lt;li&gt; To preserve historical paths development took, what branches were combined and so on &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to Rebase?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When working on a solo project &lt;/li&gt;
&lt;li&gt;To avoid unnecessary merge conflicts &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Merge conflicts&lt;/strong&gt;&lt;br&gt;
A Merge Conflict occurs when changes are made on the same line of code by different developers. A Merge Conflict can also happen if the file with the changes made in has been deleted. A Merge Conflict has to be resolved before a Merge can happen. &lt;/p&gt;

&lt;p&gt;Pull requests go through several states. The first one is the open state which indicates the PR is active and under construction ready to be merged. The second stage is the approved stage after which one or more reviewers have gone through the code and are satisfied with the states. This indicates that the PR is ready to be merged. Change Requested states. This indicates that a reviewer requested that changes be made in a particular file before the PR can be merged. Closed PR. A PR that is closed has been merged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Git Cherry Picking&lt;/strong&gt;&lt;br&gt;
 Git cherry Picking is an advance merging method. Gits Cherry Picking copies specific commits to another branch. It moves specific commits from one branch and then just that commit is moved into another branch. It creates duplicate commits in each branches, which can also cause confusion. &lt;/p&gt;

&lt;p&gt;It is an advanced Gits feature and shouldn't replace a commit.Cherry‑pick does not move the commit. It creates a copy of the commit, but with a new parent in the branch that you're cherry‑picking into. The original commit stays the same. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to cherrypick?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;bug fix that applies to multiple versions of a product &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge changes from a branch into another without merging the entire branch.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Git Blame&lt;/strong&gt;&lt;br&gt;
Git Blame is one of the many layers of the onion. It shows the last changes made in the file, when it was made and who made them&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use Gif Blame&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When debugging, it can be used to trace who walked on the path. &lt;/li&gt;
&lt;li&gt;To preserve history.&lt;/li&gt;
&lt;li&gt;For accountability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding Git is like peeling an onion layer by layer Before you get to the core, which is understanding how Git works, we have to peel through each layers, one after the other. Pool request, branching, etc. There are several other layers that are also not discussed in this article.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
