<?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: Alaa</title>
    <description>The latest articles on DEV Community by Alaa (@alaakh).</description>
    <link>https://dev.to/alaakh</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%2F4251502%2Feb67313c-466b-442d-96c9-0a093ec3bf22.png</url>
      <title>DEV Community: Alaa</title>
      <link>https://dev.to/alaakh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alaakh"/>
    <language>en</language>
    <item>
      <title>Creating Staggered Scroll Animations in React Using AOS</title>
      <dc:creator>Alaa</dc:creator>
      <pubDate>Fri, 20 Nov 2026 21:19:44 +0000</pubDate>
      <link>https://dev.to/alaakh/creating-staggered-scroll-animations-in-react-using-aos-4551</link>
      <guid>https://dev.to/alaakh/creating-staggered-scroll-animations-in-react-using-aos-4551</guid>
      <description>&lt;p&gt;Have you ever noticed how some websites reveal their content gradually as you scroll down the page?&lt;br&gt;
Instead of displaying all elements at once, headings, buttons, images, and other elements appear with smooth animations.&lt;br&gt;
This technique is often called Staggered Animations.&lt;br&gt;
In this tutorial, I'll show you how to create this effect in a React application using a lightweight JavaScript library called AOS (Animate On Scroll).&lt;br&gt;
I'll use a real example from my Cosmetics website to demonstrate how different elements can appear with different animation delays.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is AOS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AOS stands for Animate On Scroll.&lt;br&gt;
It's a JavaScript library that allows developers to animate elements when they enter the viewport.&lt;br&gt;
Instead of implementing custom scroll event listeners, we can simply add HTML data attributes to the elements we want to animate.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;h1&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Welcome&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="nc"&gt;Our&lt;/span&gt; &lt;span class="nc"&gt;Website&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;This makes the heading appear with a fade-up animation when it enters the viewport.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing AOS in React&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, install the library:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Next, import AOS and its CSS file into your React application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'react'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Aos&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'aos'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s1"&gt;'aos/dist/aos.css'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then initialize the library inside your main component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;Aos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's understand the configuration:&lt;br&gt;
duration: 1000 sets the animation duration to 1000 milliseconds.&lt;br&gt;
Aos.init() initializes the animation library.&lt;br&gt;
useEffect() runs the initialization after the component mounts.&lt;br&gt;
[] ensures the effect runs only once per mount.&lt;br&gt;
Now AOS is ready to use throughout the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding Staggered Animations&lt;/strong&gt; &lt;br&gt;
One interesting feature of AOS is the ability to control when individual elements start their animations.&lt;br&gt;
We can achieve this using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"500"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The delay value is measured in milliseconds.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"200"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;First&lt;/span&gt; &lt;span class="nc"&gt;Element&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&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="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"400"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Second&lt;/span&gt; &lt;span class="nc"&gt;Element&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&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="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"600"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Third&lt;/span&gt; &lt;span class="nc"&gt;Element&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each element has the same animation, but a different delay.&lt;br&gt;
This creates a sequential visual effect rather than making all elements animate simultaneously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Real Example from My React Project&lt;/strong&gt; &lt;br&gt;
In my Cosmetics website, I used this technique inside the Hero section.&lt;br&gt;
The goal was to make the content appear gradually and create a more engaging first impression.&lt;br&gt;
Here is a simplified version of the implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Hero&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="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="n"&gt;section&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="n"&gt;hgroup&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"500"&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="n"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nc"&gt;Enhance&lt;/span&gt; &lt;span class="nc"&gt;Your&lt;/span&gt; &lt;span class="nc"&gt;Natural&lt;/span&gt; &lt;span class="nc"&gt;Beauty&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;h1&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="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nc"&gt;Discover&lt;/span&gt; &lt;span class="n"&gt;beauty&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;skincare&lt;/span&gt; &lt;span class="n"&gt;treatments&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&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="n"&gt;hgroup&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="n"&gt;nav&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"600"&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="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"#appointment"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nc"&gt;Book&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="nc"&gt;Consultation&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;a&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="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"#services"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nc"&gt;Explore&lt;/span&gt; &lt;span class="nc"&gt;Services&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;a&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="n"&gt;nav&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="n"&gt;aside&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"800"&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="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nc"&gt;Happy&lt;/span&gt; &lt;span class="nc"&gt;Clients&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&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="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nc"&gt;Specialists&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&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="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nc"&gt;Treatments&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&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="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nc"&gt;Years&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&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="n"&gt;aside&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="n"&gt;figure&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"700"&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="n"&gt;img&lt;/span&gt;
          &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/images/hero.png"&lt;/span&gt;
          &lt;span class="n"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Cosmetic treatment"&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="n"&gt;figure&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="n"&gt;section&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="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Notice that I didn't apply the animation to every individual element.&lt;br&gt;
Instead, I applied it to groups of related elements using semantic HTML elements such as hgroup, nav, aside, and figure.&lt;br&gt;
This keeps the JSX cleaner and makes the animation behavior easier to manage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyzing the Animation Delays&lt;/strong&gt; &lt;br&gt;
Let's look at the actual delay values used in my project:&lt;/p&gt;

&lt;p&gt;Heading &amp;amp; Description: fade-up — 500ms&lt;br&gt;
Navigation Buttons: fade-up — 600ms&lt;br&gt;
Hero Image: fade-up — 700ms&lt;br&gt;
Statistics: fade-up — 800ms&lt;/p&gt;

&lt;p&gt;All four elements use the same animation, but their delays create a layered visual experience.&lt;br&gt;
One important detail: the delays are relative to when each element's animation is triggered, so the actual appearance sequence can also depend on when each element enters the viewport.&lt;br&gt;
This gives developers more control over how content is revealed while scrolling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other Animation Effects You Can Use&lt;/strong&gt; &lt;br&gt;
AOS provides several animation types beyond fade-up.&lt;br&gt;
Here are a few examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="n"&gt;jsx&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-up"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Fade&lt;/span&gt; &lt;span class="nc"&gt;Up&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&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="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"fade-right"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Fade&lt;/span&gt; &lt;span class="nc"&gt;Right&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&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="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"zoom-in"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Zoom&lt;/span&gt; &lt;span class="nc"&gt;In&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&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="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;aos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"flip-left"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Flip&lt;/span&gt; &lt;span class="nc"&gt;Left&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can experiment with different effects depending on the design of your website.&lt;br&gt;
For example, fade animations work well for text, while zoom animations can be useful for images and visual cards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some Tips from My Experience&lt;/strong&gt; &lt;br&gt;
After working with AOS in my React project, here are a few things I recommend:&lt;br&gt;
Don't animate every element. Too many animations can make the interface distracting.&lt;br&gt;
Use delays carefully to create a natural visual flow.&lt;br&gt;
Keep animation durations reasonable.&lt;br&gt;
Test your animations on mobile devices.&lt;br&gt;
Consider users who prefer reduced motion.&lt;br&gt;
Animations should improve the user experience, not slow down the interaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt; &lt;br&gt;
Adding scroll animations to a React application doesn't have to be complicated.&lt;br&gt;
With AOS, we can create engaging visual effects using simple data attributes without writing custom scroll detection logic.&lt;br&gt;
The most interesting part is not simply adding animations, but controlling their timing to create a more natural and enjoyable browsing experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you prefer using animation libraries like AOS, or do you prefer implementing animations with CSS?&lt;br&gt;
Share your thoughts in the comments!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>What Happens Behind the Scenes When You Visit a Website?</title>
      <dc:creator>Alaa</dc:creator>
      <pubDate>Fri, 20 Nov 2026 07:40:11 +0000</pubDate>
      <link>https://dev.to/alaakh/what-happens-behind-the-scenes-when-you-visit-a-website-25c8</link>
      <guid>https://dev.to/alaakh/what-happens-behind-the-scenes-when-you-visit-a-website-25c8</guid>
      <description>&lt;p&gt;Have you ever wondered what actually happens the millisecond you hit the "Enter" key on your browser? We see a page load in an instant, but under the hood, there is a complex, choreographed dance happening between your computer and servers around the globe.&lt;/p&gt;

&lt;p&gt;Let’s break down this journey into three simple acts.&lt;/p&gt;

&lt;p&gt;Act 1: The Address Book (DNS)&lt;/p&gt;

&lt;p&gt;Imagine you want to call a friend, but you don't remember their phone number. You look it up in your contacts, right?&lt;/p&gt;

&lt;p&gt;When you type google.com into your browser, the computer doesn't actually know where that is. Computers communicate using IP addresses (like 142.250.190.46), not words. This is where the Domain Name System (DNS) comes in.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your browser asks a "DNS Resolver" (usually provided by your ISP): "Hey, where does google.com live?"&lt;/li&gt;
&lt;li&gt;The resolver checks its cache. If it doesn't know, it asks higher-level servers (Root servers, TLD servers, and finally, the Authoritative Name Server).&lt;/li&gt;
&lt;li&gt;Eventually, the answer returns: 142.250.190.46.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now your browser has the address it needs to make the connection.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffyodidqfchk2dsirunfw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffyodidqfchk2dsirunfw.jpg" alt=" " width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Act 2: The Secret Handshake (SSL/TLS)&lt;/p&gt;

&lt;p&gt;Before your browser starts asking for website data, it needs to ensure the conversation is private. We do this using HTTPS. &lt;/p&gt;

&lt;p&gt;You've likely seen the little padlock icon in your URL bar. To get that, the browser and the server perform an SSL/TLS Handshake. &lt;/p&gt;

&lt;p&gt;Think of it as two spies meeting in an alleyway to establish a secret code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client Hello: Your browser says, "Hi! I support these encryption methods."&lt;/li&gt;
&lt;li&gt;Server Hello: The server replies, "Great, let's use this one. Here is my digital certificate (ID card) to prove I am who I say I am."&lt;/li&gt;
&lt;li&gt;Key Exchange: They exchange cryptographic keys. Once they agree on a key, all future traffic is encrypted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If someone tries to "listen in" on the data traveling between you and the server, they’ll only see scrambled nonsense.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6nxzwbpvg40t2eqcrvb9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6nxzwbpvg40t2eqcrvb9.jpg" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Act 3: The Restaurant Kitchen (The Backend)&lt;/p&gt;

&lt;p&gt;Now that the secure channel is open, your browser sends an HTTP request: "Can I have the homepage, please?"&lt;/p&gt;

&lt;p&gt;The request hits the server. Think of the server as a high-end restaurant:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Waiter (Nginx or Apache): This is the web server software. It’s the first point of contact. It checks the request, ensures the files exist, and decides who in the kitchen should handle this order.&lt;/li&gt;
&lt;li&gt;The Chef (Laravel or Node.js): The web server passes the request to your backend application code. The code acts as the chef. It looks at the request—maybe you're logged in, maybe you're asking for a specific user profile—and figures out what data is needed.&lt;/li&gt;
&lt;li&gt;The Pantry (Database): Often, the "chef" needs ingredients. It queries the database (like MySQL or PostgreSQL) to fetch user information, posts, or product details.&lt;/li&gt;
&lt;li&gt;The Plating (Response): Once the chef has the data, they combine it with HTML templates. The server then sends this final, fully-formed page back to your browser as an HTTP response.&lt;/li&gt;
&lt;/ol&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8nu4pzp6zd92vr7488eo.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8nu4pzp6zd92vr7488eo.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Summary: The Big Picture&lt;/p&gt;

&lt;p&gt;• DNS converts the name to an IP address (finding the house).&lt;br&gt;
• SSL/TLS secures the tunnel (locking the door).&lt;br&gt;
• The Backend processes your request, pulls data from the database, and serves the content (cooking the meal).&lt;/p&gt;

&lt;p&gt;The next time you load a webpage, take a second to appreciate the thousands of miles, milliseconds of computation, and complex security protocols happening just to display that text on your screen!&lt;/p&gt;

&lt;p&gt;Pro Tip: Want to see this in action? Open your browser's Developer Tools (F12), go to the Network tab, and refresh your page. You will see every single request and response happening in real-time! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
