<?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: I-am-abdulazeez</title>
    <description>The latest articles on DEV Community by I-am-abdulazeez (@iamabdulazeez).</description>
    <link>https://dev.to/iamabdulazeez</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%2F388031%2F2b7daf84-58af-4e4f-9c08-f266306a6f8c.png</url>
      <title>DEV Community: I-am-abdulazeez</title>
      <link>https://dev.to/iamabdulazeez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamabdulazeez"/>
    <language>en</language>
    <item>
      <title>Introducing Stunk — A Minimalist, Reactive State Management Library.</title>
      <dc:creator>I-am-abdulazeez</dc:creator>
      <pubDate>Fri, 07 Mar 2025 08:14:33 +0000</pubDate>
      <link>https://dev.to/iamabdulazeez/introducing-stunk-a-minimalist-reactive-state-management-library-23f8</link>
      <guid>https://dev.to/iamabdulazeez/introducing-stunk-a-minimalist-reactive-state-management-library-23f8</guid>
      <description>&lt;p&gt;If you’ve ever wrestled with state management in JavaScript or TypeScript, you know the struggle: bloated libraries, unnecessary re-renders, and a tangled web of dependencies. What if there was a &lt;strong&gt;simpler, more lightweight&lt;/strong&gt; solution? Enter &lt;strong&gt;Stunk&lt;/strong&gt; — a minimalist, framework-agnostic state management library designed to be &lt;strong&gt;reactive, performant, and easy to use&lt;/strong&gt;. Written in &lt;strong&gt;TypeScript&lt;/strong&gt; with full type inference. Stunk ensures a seamless developer experience without sacrificing power.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Stunk?&lt;/strong&gt;&lt;br&gt;
State management is the backbone of modern frontend development, but most solutions come with trade-offs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Redux&lt;/strong&gt; requires boilerplate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context API&lt;/strong&gt; causes excessive re-renders.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recoil and Jotai&lt;/strong&gt; introduce their own learning curves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zustand&lt;/strong&gt; is simple but lacks fine-grained reactivity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stunk takes a different approach, balancing simplicity with power:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Minimalistic API:&lt;/strong&gt; No unnecessary complexity, just &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;set&lt;/code&gt;, &lt;code&gt;subscribe&lt;/code&gt;, and a few powerful utilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reactivity First:&lt;/strong&gt; Fine-grained reactivity ensures that components re-render only when necessary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Framework-Agnostic:&lt;/strong&gt; Works seamlessly with React, Vue, and even vanilla JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous State:&lt;/strong&gt; &lt;code&gt;asyncChunk&lt;/code&gt; handles async data elegantly with &lt;code&gt;loading&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, and &lt;code&gt;data&lt;/code&gt; states built-in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selectors &amp;amp; Computed State:&lt;/strong&gt; Update only specific parts of the state while keeping reactivity intact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Middlewares &amp;amp; Extensions:&lt;/strong&gt; Features like &lt;code&gt;withHistory&lt;/code&gt; and &lt;code&gt;withPersistence&lt;/code&gt; add flexibility without bloating the core.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Talk is cheap. Here's the code.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started with Stunk&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Setting up Stunk is straightforward. Install it via npm or your favorite package manager:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i stunk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, define and use a &lt;strong&gt;Chunk&lt;/strong&gt; (a reactive state unit):&lt;br&gt;
&lt;/p&gt;

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

const counter = chunk(0);

console.log(counter.get()); // 0
counter.set(10);
console.log(counter.get()); // 10
counter.set(prev =&amp;gt; prev + 1); // Logs: New Value: 11

// Reactively subscribe to changes
counter.subscribe(value =&amp;gt; {
  console.log("New Value:", value);
});

// Reset to initial value
counterChunk.reset(); // 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stunk in React
&lt;/h2&gt;

&lt;p&gt;Stunk integrates seamlessly with React using &lt;code&gt;stunk/react&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { chunk } from 'stunk';
import { useChunk } from 'stunk/react';

const count = chunk(0);

function Counter() {
 const [value, set] = useChunk(count);
 return (
   &amp;lt;div&amp;gt;
     &amp;lt;p&amp;gt;Count: {value}&amp;lt;/p&amp;gt;
     &amp;lt;button onClick={() =&amp;gt; set(prev =&amp;gt; prev + 1)}&amp;gt;Increment&amp;lt;/button&amp;gt;
   &amp;lt;/div&amp;gt;
 );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Asynchronous State with asyncChunk
&lt;/h2&gt;

&lt;p&gt;Handling async data? &lt;code&gt;asyncChunk&lt;/code&gt; makes it a breeze:&lt;br&gt;
&lt;/p&gt;

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

const userChunk = asyncChunk(async () =&amp;gt; {
  const res = await fetch('https://jsonplaceholder.typicode.com/users/1');
  return res.json(); 
});

userChunk.subscribe(({ loading, data, error }) =&amp;gt; {
  if (loading) console.log("Loading...");
  else if (error) console.error(error);
  else console.log("User:", data);
});

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stunk's Vision
&lt;/h2&gt;

&lt;p&gt;Stunk is built to be lightweight yet powerful, giving developers fine-grained control over reactivity without unnecessary complexity. Whether you're building small projects or large-scale applications, &lt;strong&gt;Stunk adapts to your needs&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try Stunk Today
&lt;/h2&gt;

&lt;p&gt;Stunk is open-source and ready for your next project. Check out the GitHub repo and start building:&lt;/p&gt;

&lt;p&gt;🔗 GitHub: &lt;a href="https://github.com/I-am-abdulazeez/stunk" rel="noopener noreferrer"&gt;Github Repo&lt;/a&gt;&lt;br&gt;
🚀 Docs: &lt;a href="https://stunk.vercel.app/" rel="noopener noreferrer"&gt;Stunk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's redefine state management together. Happy coding! ✨&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>react</category>
      <category>statemangement</category>
    </item>
    <item>
      <title>Why you should start using ChakraUI (Part 1).</title>
      <dc:creator>I-am-abdulazeez</dc:creator>
      <pubDate>Thu, 01 Dec 2022 06:18:38 +0000</pubDate>
      <link>https://dev.to/iamabdulazeez/why-you-should-start-using-chakraui-part-1-57f1</link>
      <guid>https://dev.to/iamabdulazeez/why-you-should-start-using-chakraui-part-1-57f1</guid>
      <description>&lt;p&gt;Hi Devs, hope you're all doing great!&lt;/p&gt;

&lt;p&gt;We are going to be discussing ChakraUI.&lt;/p&gt;

&lt;p&gt;I want to clear some misconceptions about &lt;strong&gt;ChakraUI&lt;/strong&gt;. I'm not working for &lt;strong&gt;ChakraUI&lt;/strong&gt;. I'm also not an ambassador for Chakra, these are just the experience and some research I have made on the library. &lt;/p&gt;

&lt;p&gt;No doubt, there are a lot of &lt;strong&gt;component libraries&lt;/strong&gt; based on React in 2022. Therefore, picking the best might be hard to find but picking one that will save you stress shows how creative you are as a Frontend developer.&lt;/p&gt;

&lt;p&gt;I'm not here to praise any &lt;strong&gt;React&lt;/strong&gt; component library, but here to talk about my experience using &lt;strong&gt;ChakraUI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I know you are familiar with some of the best component libraries based on React out there. E.g &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mantine (Very close to chakra-UI).&lt;/li&gt;
&lt;li&gt;MUI (Formally Material-UI).&lt;/li&gt;
&lt;li&gt;Tailwind (ChakraUI Inspiration).&lt;/li&gt;
&lt;li&gt;DaisyUI&lt;/li&gt;
&lt;li&gt;And lot more...&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;ChakraUI&lt;/strong&gt;, as it states is a &lt;strong&gt;simple&lt;/strong&gt;, &lt;strong&gt;modular&lt;/strong&gt; and &lt;strong&gt;accessible&lt;/strong&gt; component library that gives you the building blocks you need to build your &lt;strong&gt;React&lt;/strong&gt; applications.&lt;/p&gt;

&lt;p&gt;The words &lt;strong&gt;'simple, modular and accessible'&lt;/strong&gt;, ringed a bell to me when I was looking around for a component library more like tailwind in the react world. I personally love tailwind, but I thought to myself that I don't want to write a logic in my code just to open a modal or do some simple component logic stuffs. I just want to have a nice-looking library that does that for me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features of ChakraUI
&lt;/h2&gt;

&lt;p&gt;As stated on &lt;strong&gt;ChakraUI's&lt;/strong&gt; documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzeq0wprk1tz34mp090id.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%2Fzeq0wprk1tz34mp090id.png" alt="ChakraUI features" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your preferred component library cannot offer you the first 5 on the list, I bet it is not a complete component library. In this way, &lt;strong&gt;ChakraUI&lt;/strong&gt; shines. especially the fact that i can compose components differently as if it was designed by two different entities.&lt;/p&gt;

&lt;h2&gt;
  
  
  ChakraUI vs Tailwind
&lt;/h2&gt;

&lt;p&gt;Without doubt, &lt;strong&gt;ChakraUI&lt;/strong&gt; picked it inspiration from &lt;strong&gt;TailwindCSS&lt;/strong&gt;. I'm really excited it did.&lt;/p&gt;

&lt;p&gt;Last year, I worked on a project on React where we used &lt;strong&gt;Tailwindcss&lt;/strong&gt;. Building with it was fun, but we have one goal in mine, which was: &lt;em&gt;we do not want to waste time on the UI of our app&lt;/em&gt;. Using Tailwind was like stressful for us, because we had to build the components, pass props, manage their states and the likes.We found ourselves writing another component library. We found ourselves doing this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { forwardRef, Ref, ElementType } from "react";
import { classNames } from "../../utils/functions";
import { ButtonBase, ButtonBaseProps } from "../base/buttonBase";
import { ImSpinner8 } from "react-icons/im";
import { SrOnly } from "../base/srOnly";
import { ButtonProps } from "../../utils/interfaces";

function Button&amp;lt;P extends ElementType = "button"&amp;gt;(
  {
    className,
    children,
    loadingText = "Loading...",
    groupHoverAnimation,
    animateOnHover = false,
    id,
    onClick,
    size = "md",
    isDisabled = false,
    isFullWidth = false,
    isLoading = false,
    leftIcon,
    rightIcon,
    iconSpacing = "md",
    ariaLabel,
    ...props
  }: ButtonProps &amp;amp; ButtonBaseProps&amp;lt;P&amp;gt;,
  ref: Ref&amp;lt;HTMLButtonElement&amp;gt;
) {
  const sizeType =
    size === "xs"
      ? "btn-xs"
      : size === "sm"
      ? "btn-sm"
      : size === "md"
      ? "btn-md"
      : size === "lg"
      ? "btn-lg"
      : null;

  const iconSize =
    size === "xs"
      ? "text-[12px]"
      : size === "sm"
      ? "text-[14px]"
      : size === "md"
      ? "text-[16px]"
      : size === "lg"
      ? "text-[18px]"
      : null;

  const groupHoverAnimationType =
    groupHoverAnimation === "grow"
      ? "group-hover:animate-grow"
      : groupHoverAnimation === "roll"
      ? "group-hover:animate-roll"
      : groupHoverAnimation === "wiggle"
      ? "group-hover:animate-wiggle"
      : null;

  const iconSpacingType =
    iconSpacing === "sm" &amp;amp;&amp;amp; leftIcon
      ? "mr-1"
      : iconSpacing === "md" &amp;amp;&amp;amp; leftIcon
      ? "mr-1.5"
      : iconSpacing === "lg" &amp;amp;&amp;amp; leftIcon
      ? "mr-2"
      : iconSpacing === "xl" &amp;amp;&amp;amp; leftIcon
      ? "mr-3"
      : iconSpacing === "sm" &amp;amp;&amp;amp; rightIcon
      ? "ml-1"
      : iconSpacing === "md" &amp;amp;&amp;amp; rightIcon
      ? "ml-1.5"
      : iconSpacing === "lg" &amp;amp;&amp;amp; rightIcon
      ? "ml-2"
      : iconSpacing === "xl" &amp;amp;&amp;amp; rightIcon
      ? "mr-3"
      : null;

  const animateOnHoverType = animateOnHover ? "btn-animate" : null;

  const isFullWidthType = isFullWidth ? "w-full" : "w-[max-content]";

  return (
    &amp;lt;ButtonBase
      {...(props as ButtonBaseProps)}
      id={id}
      onClick={onClick}
      ref={ref}
      aria-busy={isLoading ?? false}
      disabled={isDisabled || isLoading}
      className={classNames(
        `${className} ${isFullWidthType} ${sizeType} ${animateOnHoverType} group active:transform active:scale-[0.98]`
      )}
    &amp;gt;
      {leftIcon &amp;amp;&amp;amp; (
        &amp;lt;span
          aria-hidden="true"
          className={classNames(
            `${iconSpacingType} ${iconSize} ${groupHoverAnimationType}`
          )}
        &amp;gt;
          {leftIcon}
        &amp;lt;/span&amp;gt;
      )}
      {isLoading &amp;amp;&amp;amp; (
        &amp;lt;span
          aria-hidden="true"
          className={classNames(`${iconSize} animate-spin mr-1.5`)}
        &amp;gt;
          &amp;lt;ImSpinner8 /&amp;gt;
        &amp;lt;/span&amp;gt;
      )}
      {isLoading &amp;amp;&amp;amp; loadingText ? loadingText : children}
      {rightIcon &amp;amp;&amp;amp; (
        &amp;lt;span
          aria-hidden="true"
          className={classNames(
            `${iconSpacingType} ${iconSize} ${groupHoverAnimationType}`
          )}
        &amp;gt;
          {rightIcon}
        &amp;lt;/span&amp;gt;
      )}
      {ariaLabel &amp;amp;&amp;amp; &amp;lt;SrOnly&amp;gt;{ariaLabel}&amp;lt;/SrOnly&amp;gt;}
    &amp;lt;/ButtonBase&amp;gt;
  );
}

export default forwardRef(Button) as typeof Button;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Obviously, there's nothing bad here, except you find a bug devs!😉😉😉. We want to achieve some features here, &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Accessibility&lt;/code&gt;, &lt;code&gt;Theming&lt;/code&gt;, &lt;code&gt;Composable&lt;/code&gt;, &lt;code&gt;Light and Dark features&lt;/code&gt;&lt;/strong&gt; and so on. &lt;/p&gt;

&lt;p&gt;Nice work from my colleagues &lt;a href="https://github.com/moyohussein" rel="noopener noreferrer"&gt;MoyoHussien&lt;/a&gt;. This is not even the &lt;code&gt;baseButton&lt;/code&gt; component, this is the main button component, we have a &lt;code&gt;baseButton&lt;/code&gt; component also. We found ourselves writing a lot and there's no time on our side.&lt;/p&gt;

&lt;p&gt;The funny thing is that we knew about &lt;strong&gt;ChakraUI&lt;/strong&gt;, but we were thinking it is not flexible like &lt;strong&gt;TailwindCSS&lt;/strong&gt;. Yes! I agree it is not, but it is very close.&lt;/p&gt;

&lt;p&gt;You might disagree with me dev, but please if your goal is to build fast, go with &lt;code&gt;ChakraUI&lt;/code&gt; and thank me later.&lt;/p&gt;

&lt;h2&gt;
  
  
  ChakraUI Ships more Javascript
&lt;/h2&gt;

&lt;p&gt;I have seen series of posts and video, saying chakra-ui ships more &lt;strong&gt;javascript&lt;/strong&gt;, due to the fact that it uses &lt;strong&gt;javascript&lt;/strong&gt; not &lt;strong&gt;css&lt;/strong&gt;. Lol!.&lt;/p&gt;

&lt;p&gt;What do you except from a React component library? &lt;/p&gt;

&lt;p&gt;Let's break it down,&lt;/p&gt;

&lt;p&gt;Javascript -&amp;gt; Typescript -&amp;gt; React -&amp;gt; ChakraUI&lt;/p&gt;

&lt;p&gt;Why won't it ship Javascript and on top of that, it's also really small (375kB minified, 101kB minified, and gzipped, although you should remember that besides the core Chakra library you have to install Emotion). &lt;/p&gt;

&lt;p&gt;Note: I'm not been payed by &lt;strong&gt;ChakraUI&lt;/strong&gt; or anyone, this is just my own opinion.&lt;/p&gt;

&lt;p&gt;In the next series, we will continue from here.&lt;/p&gt;

&lt;p&gt;One love from Nigeria.!&lt;/p&gt;

&lt;p&gt;This is my First post on DevTo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with ChakraUI
&lt;/h2&gt;

&lt;p&gt;....&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
  </channel>
</rss>
