<?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: Unnati Srivastava</title>
    <description>The latest articles on DEV Community by Unnati Srivastava (@unnati_srivastava_0430094).</description>
    <link>https://dev.to/unnati_srivastava_0430094</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%2F3207126%2F6efa1df9-da2b-4d73-aac5-b21e8ed4893f.png</url>
      <title>DEV Community: Unnati Srivastava</title>
      <link>https://dev.to/unnati_srivastava_0430094</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/unnati_srivastava_0430094"/>
    <language>en</language>
    <item>
      <title>Creating an animated website Using GSAP with Next.js and Tailwind CSS</title>
      <dc:creator>Unnati Srivastava</dc:creator>
      <pubDate>Sun, 08 Jun 2025 20:09:40 +0000</pubDate>
      <link>https://dev.to/unnati_srivastava_0430094/creating-an-animated-website-using-gsap-with-nextjs-and-tailwind-css-55ab</link>
      <guid>https://dev.to/unnati_srivastava_0430094/creating-an-animated-website-using-gsap-with-nextjs-and-tailwind-css-55ab</guid>
      <description>&lt;p&gt;As a developer who appreciates seamless UI/UX and smooth transitions, discovering GSAP (GreenSock Animation Platform) felt like finding a cheat code to modern frontend animation. In this blog, I’ll walk you through why GSAP is a top-tier animation library, how I used it in a Next.js project styled with Tailwind CSS, and some key concepts like ScrollTrigger, Timeline, scrub, pin, and motion along x, y axes.&lt;/p&gt;

&lt;p&gt;Getting Started: Next.js, Tailwind, and GSAP&lt;br&gt;
Before we get into the fun parts, here's the basic stack I used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js for a powerful React-based framework with SSR support.&lt;/li&gt;
&lt;li&gt;Tailwind CSS for utility-first styling (which makes it a breeze to build responsive layouts).&lt;/li&gt;
&lt;li&gt;GSAP for smooth, performant animations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now installing GSAP is very simple :&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;In Next.js, you can import and use it within useEffect like so:&lt;br&gt;
&lt;/p&gt;

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

useEffect(() =&amp;gt; {
  gsap.to(".box", { x: 100, duration: 2 });
}, []);

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

&lt;/div&gt;



&lt;p&gt;This alone already animates elements effortlessly — but the real power lies ahead.&lt;/p&gt;

&lt;p&gt;So here's why GSAP is Awesome &lt;br&gt;
GSAP isn’t just another animation library — it’s fast, intuitive, and incredibly powerful. Here's why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance-First: It’s optimized for high performance, making your animations buttery smooth.&lt;/li&gt;
&lt;li&gt;Fine Control: GSAP gives you pixel-level control over your animations.&lt;/li&gt;
&lt;li&gt;Flexible Syntax: You can chain animations, create timelines, and control playback easily.&lt;/li&gt;
&lt;li&gt;Scroll-Based Animations: Combine it with ScrollTrigger to create dynamic interactions based on scroll position.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Magic of ScrollTrigger&lt;br&gt;
ScrollTrigger is an official GSAP plugin that enables you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trigger animations when an element enters the viewport.&lt;/li&gt;
&lt;li&gt;Pin sections during scrolling (parallax and other effects).&lt;/li&gt;
&lt;li&gt;Sync animations with scroll progress (scrub).&lt;/li&gt;
&lt;li&gt;Animate based on scroll position.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { ScrollTrigger } from 'gsap/ScrollTrigger';

gsap.registerPlugin(ScrollTrigger);

gsap.to(".box", {
  scrollTrigger: {
    trigger: ".box",
    start: "top center",
    end: "bottom center",
    scrub: true,
    pin: true
  },
  x: 300,
  duration: 3
});

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

&lt;/div&gt;


&lt;p&gt;Understanding Key Concepts&lt;br&gt;
&lt;strong&gt;scrub&lt;/strong&gt;&lt;br&gt;
Scrub syncs the animation's progress with the scrollbar. This means the animation progresses as you scroll. It can take a boolean or even a smoothing number like scrub: 1.5.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;pin&lt;/strong&gt;&lt;br&gt;
Pin keeps the element fixed while you scroll through the section. Great for storytelling layouts or full-screen sections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;x and y&lt;/strong&gt;&lt;br&gt;
These properties control the horizontal (x) and vertical (y) movement of an element. You can move elements in 2D space, which is key for dynamic transitions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gsap.to(".element", {
  x: 100, // move right by 100px
  y: 50,  // move down by 50px
  duration: 1.5
});

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

&lt;/div&gt;



&lt;p&gt;Timeline: Chaining Animations Like a Pro&lt;br&gt;
Another powerful feature is gsap.timeline(). It lets you sequence animations, making it easier to coordinate multiple effects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const tl = gsap.timeline();

tl.to(".title", { y: 0, opacity: 1, duration: 1 })
  .to(".subtitle", { x: 0, opacity: 1, duration: 1 }, "-=0.5")
  .to(".button", { scale: 1, opacity: 1, duration: 0.5 });

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Benefits of using Timeline:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organize complex animations cleanly.&lt;/li&gt;
&lt;li&gt;Sync different animations together.&lt;/li&gt;
&lt;li&gt;Add delays and overlaps easily.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Developer Experience&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Working with GSAP in a Next.js + Tailwind environment has been incredibly smooth. Here’s why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modular: You can scope your animations easily using refs or class names.&lt;/li&gt;
&lt;li&gt;Component-Friendly: Perfect for React-based frameworks like Next.js.&lt;/li&gt;
&lt;li&gt;Integrates with Tailwind: Use Tailwind to handle layout/styling and GSAP purely for animation logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So yes, GSAP elevates your frontend game. Pair it with modern frameworks like Next.js and styling tools like Tailwind, and you’ve got a high-performing, interactive web experience.&lt;/p&gt;

</description>
      <category>gsap</category>
      <category>webdev</category>
      <category>nextjs</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Why Your React App is Slow (And How to Fix It Like a Pro)</title>
      <dc:creator>Unnati Srivastava</dc:creator>
      <pubDate>Sun, 25 May 2025 19:17:27 +0000</pubDate>
      <link>https://dev.to/unnati_srivastava_0430094/why-your-react-app-is-slow-and-how-to-fix-it-like-a-pro-fp</link>
      <guid>https://dev.to/unnati_srivastava_0430094/why-your-react-app-is-slow-and-how-to-fix-it-like-a-pro-fp</guid>
      <description>&lt;p&gt;Let’s face it — React is fast... &lt;em&gt;until it’s not&lt;/em&gt;. You’ve probably been there: you build a sleek UI, everything works great in dev, but once your app grows or hits production, it starts to lag. Clicks feel sluggish, page loads are slow, and animations stutter. The worst part is that You’re not even sure where it’s going wrong.&lt;/p&gt;

&lt;p&gt;**Problem #1: Unnecessary Re-renders Are Sneaky&lt;/p&gt;

&lt;p&gt;**One of the most common reasons React apps become sluggish is because components re-render more often than they need to. React re-renders a component whenever its props or state change — but not all changes are meaningful.&lt;/p&gt;

&lt;p&gt;Let’s say you’re passing props like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;MyComponent someProp={Math.random()} /&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Every time the parent re-renders, someProp changes (because Math.random() returns a new value), and that causes MyComponent to re-render — even if nothing user-facing changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Fix it:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Use React.memo to memoize your components. This tells React, “only re-render this component if the props actually change.”&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const MyComponent = React.memo(({ someProp }) =&amp;gt; {&lt;br&gt;
  return &amp;lt;div&amp;gt;{someProp}&amp;lt;/div&amp;gt;;&lt;br&gt;
});&lt;/code&gt;&lt;br&gt;
This simple change can dramatically reduce unnecessary work in large component trees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem #2: Poor List Rendering&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rendering long lists using .map() is fine for small datasets — but once you start dealing with hundreds or thousands of items, it becomes a performance bottleneck.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{items.map(item =&amp;gt; &amp;lt;Item key={item.id} data={item} /&amp;gt;)}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This approach forces React to render every item, even those that aren’t visible on the screen. That’s a lot of wasted effort.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Fix it:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Use windowing libraries like react-window or react-virtualized to render only the items that are currently in view. Here's an example:&lt;/p&gt;

&lt;p&gt;`import { FixedSizeList as List } from 'react-window';&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
  {({ index, style }) =&amp;gt; (&lt;br&gt;
    &lt;br&gt;
  )}&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Your UI stays buttery smooth, no matter how large your list gets.&lt;/p&gt;

&lt;p&gt;**Problem #3: You're Loading Too Much JavaScript Upfront&lt;/p&gt;

&lt;p&gt;This one’s easy to overlook: if your app loads everything at once — every component, every image, every dependency — the initial load time can become painfully slow.&lt;/p&gt;

&lt;p&gt;_**Fix it:&lt;br&gt;
Split your code using React.lazy() and Suspense. You only load what you need, when you need it.&lt;/p&gt;

&lt;p&gt;const HeavyComponent = React.lazy(() =&amp;gt; import('./HeavyComponent'));&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading...&amp;lt;/div&amp;gt;}&amp;gt;&lt;br&gt;
  &amp;lt;HeavyComponent /&amp;gt;&lt;br&gt;
&amp;lt;/Suspense&amp;gt;&lt;br&gt;
/&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
 &lt;strong&gt;Problem #4: Misusing useEffect&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ever faced infinite re-renders or unnecessary network calls? That’s usually a sign that your useEffect dependencies aren’t correctly set.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Fix It:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Understand how dependency arrays work. Avoid writing effects that depend on values being updated inside the effect itself. Use useRef when you need a value that persists but doesn’t trigger re-renders.&lt;/p&gt;

&lt;p&gt;** Problem #5 : You're Not Profiling&lt;/p&gt;

&lt;p&gt;You can’t fix what you don’t measure. If you’re not using React’s built-in Profiler, you’re flying blind.&lt;/p&gt;

&lt;p&gt;**_Fix it:&lt;br&gt;
Install React Developer Tools and use the Profiler tab. You’ll see exactly which components are re-rendering and how long they take.&lt;/p&gt;

&lt;p&gt;Even better: combine this with console logs or performance.mark() calls to really dig into bottlenecks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Some PRO tips :&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrap callback functions in useCallback to avoid unnecessary prop changes.&lt;/li&gt;
&lt;li&gt;Avoid anonymous functions inside JSX where possible.&lt;/li&gt;
&lt;li&gt;Keep your component hierarchy flat and logical.&lt;/li&gt;
&lt;li&gt;Use StrictMode in development to catch unexpected behavior early.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A truly great React developer doesn’t just build apps that work. They build apps that feel fast, even under pressure.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>react</category>
    </item>
  </channel>
</rss>
