<?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: Rubi</title>
    <description>The latest articles on DEV Community by Rubi (@ayenyeinsan).</description>
    <link>https://dev.to/ayenyeinsan</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%2F655859%2Fbcf3cde4-717f-4673-aac8-c8c255a8ad6f.jpeg</url>
      <title>DEV Community: Rubi</title>
      <link>https://dev.to/ayenyeinsan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ayenyeinsan"/>
    <language>en</language>
    <item>
      <title>No Wonder why Zustand is Popular as Client-Side State Management libary</title>
      <dc:creator>Rubi</dc:creator>
      <pubDate>Tue, 24 Mar 2026 05:40:07 +0000</pubDate>
      <link>https://dev.to/ayenyeinsan/no-wonder-why-zustand-is-popular-as-client-side-state-management-libary-3157</link>
      <guid>https://dev.to/ayenyeinsan/no-wonder-why-zustand-is-popular-as-client-side-state-management-libary-3157</guid>
      <description>&lt;p&gt;I tested &lt;a href="https://zustand-demo.pmnd.rs/" rel="noopener noreferrer"&gt;Zustand &lt;/a&gt; state management library in React these days. It was way less boilerplate code than Redux Toolkit, which is also a state management lib in React. If you've ever felt bogged down by the boilerplate required to get a simple global state working in Redux Toolkit (RTK), you aren't alone.&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%2F3fzoqco4eoc1966cu06w.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%2F3fzoqco4eoc1966cu06w.png" alt="Zustand offical site" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Redux Toolkit&lt;/strong&gt;, even a simple state change requires a fair amount of "ceremony." To get things running, you typically have to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Slice (defining initial state and reducers).&lt;/li&gt;
&lt;li&gt;Configure the Store.&lt;/li&gt;
&lt;li&gt;Wrap your application in a Provider to grant child components access.&lt;/li&gt;
&lt;li&gt;Use multiple hooks (useDispatch and useSelector) just to interact with that state.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4cdg6hpqex4a604fmi29.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%2F4cdg6hpqex4a604fmi29.png" alt="RTK" width="800" height="519"&gt;&lt;/a&gt;&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%2Fvjqdxieui33u5hu6qssx.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%2Fvjqdxieui33u5hu6qssx.png" alt="RTK" width="800" height="695"&gt;&lt;/a&gt;&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%2F9up8y0t1t85724i2ly66.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%2F9up8y0t1t85724i2ly66.png" alt="RTK" width="800" height="437"&gt;&lt;/a&gt;&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%2Fmdd1l60ab1yzjq8eodph.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%2Fmdd1l60ab1yzjq8eodph.png" alt="RTK" width="800" height="310"&gt;&lt;/a&gt;&lt;br&gt;
While RTK is powerful, this flow can feel like a lot of heavy lifting for smaller or medium-sized features.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Zustand&lt;/strong&gt;, I have to write only the store hook for state and functions ( which is like a reducer function in RTK) and directly use that hook in the component. The component directly applies state changes using that store hook, which is less complex than redux tool kits. &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%2Fvsjs5wz5ssdu6ci25kji.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%2Fvsjs5wz5ssdu6ci25kji.png" alt="Zustand" width="800" height="694"&gt;&lt;/a&gt;&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%2F3k89d1rmlkia2d48dpo7.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%2F3k89d1rmlkia2d48dpo7.png" alt="Zustand" width="800" height="671"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, code written with Zustand is cleaner and easier to read than code written in Redux Toolkit. Since Zustand's purpose is for client-side state management, unlike the Redux toolkit, combining Zustand with &lt;a href="https://tanstack.com/query/latest" rel="noopener noreferrer"&gt;TanStack Query&lt;/a&gt;, which is a great lib for handling server-side state managemnt would be a powerhouse combination.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out the code&lt;/strong&gt;: I’ve put together a demo project comparing the two approaches here:&lt;br&gt;
&lt;a href="https://github.com/aye-nyeinSan/CosmesticStore" rel="noopener noreferrer"&gt;Cosmetic Store Demo on GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>zustand</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Basic Git Useages</title>
      <dc:creator>Rubi</dc:creator>
      <pubDate>Sun, 05 Nov 2023 16:38:41 +0000</pubDate>
      <link>https://dev.to/ayenyeinsan/basic-git-useages-opb</link>
      <guid>https://dev.to/ayenyeinsan/basic-git-useages-opb</guid>
      <description>&lt;p&gt;This article is about using Git, the version control system that we are most currently using in our developer journey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic Git Commands&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;: &lt;em&gt;git init , git clone, git status, git add, git commit, git push, git fetch, git pull&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git init&lt;/em&gt;  = to create a git repository for your project.&lt;/p&gt;

&lt;p&gt;For the first time when you create your project, and, in that project, you will use git, you need to use that command to use the other git commands for version control. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;git clone&lt;/em&gt; = copying repository in your local &lt;/p&gt;

&lt;p&gt;if you want to copy existing repository, git clone command is for you.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git status&lt;/em&gt; = checking the status of your files &lt;/p&gt;

&lt;p&gt;If you edit or delete anything from your current stage, this command can show the status of the current stage. So, you can check which files you changed.&lt;/p&gt;

&lt;p&gt;git add = adding modified files to your current stage &lt;/p&gt;

&lt;p&gt;You modified or deleted some files in your current stage. To saved that changed files in your current stage, you need to use git add command.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git add .&lt;/em&gt;  ⇒ adding all changed files to  current stage.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git add &lt;/em&gt; ⇒ adding specific changed file to current stage&lt;/p&gt;

&lt;p&gt;git commit = saving your changed files, which you have added in your stage&lt;/p&gt;

&lt;p&gt;After you have added your modified files, you need to save that stage. In that time, you have to use git commit commands.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git commit -m “{message you want to show}&lt;/em&gt;”&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git commit -a -m “{message you want others to know}”&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;if you use -a in git commit command, you can skip using git add command. In &lt;em&gt;git commit -a -m “{Message}&lt;/em&gt;”, -a is adding to stage and -m is for message.&lt;/p&gt;

&lt;p&gt;git push = to push your committed stage to remote repository from your local &lt;/p&gt;

&lt;p&gt;If you want to push your committed files to GitHub repository, you need to use this command.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git push&lt;/em&gt; ⇒ push from local to remote main or master repository&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git push -f&lt;/em&gt; ⇒ flag -f means you want to push by force.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git push -u [remote repository name] [branch name that you want to push from local]&lt;/em&gt; ⇒ flag -u is upstream, like tracking branch with your local branch. &lt;/p&gt;

&lt;p&gt;PS: The best practice is you may need to &lt;em&gt;git pull&lt;/em&gt; or &lt;em&gt;git fetch&lt;/em&gt; before you push anything to the repository in order to reduce merge conflicts later.&lt;/p&gt;

&lt;p&gt;git pull and git fetch ⇒ grabbing updates from your remote repository.&lt;/p&gt;

&lt;p&gt;Between these two commands, git fetch is used for checking the latest update of your repository, but git pull merges the latest update downloaded to your local.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git fetch&lt;/em&gt; ⇒ fetch update from remote repository&lt;/p&gt;

&lt;p&gt;&lt;em&gt;git fetch -a&lt;/em&gt; ⇒ fetching updated information from all remote repositories. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;git fetch &lt;/em&gt; ⇒ fetching specific repository. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;git pull = git fetch + git merge&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PS: After your git fetch, you will know which files got updated, and then you can use &lt;em&gt;git diff  &lt;/em&gt; to see the differences. You can fix and you can git merge.&lt;/p&gt;

&lt;p&gt;You can take reference from this YouTube video for educational purposes. They explain pretty well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=uEEcw1s_wWk" rel="noopener noreferrer"&gt;(19) Git Fetch | What is Git Fetch and How to Use it | Learn Git - YouTube&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to go back directory in Nodejs?</title>
      <dc:creator>Rubi</dc:creator>
      <pubDate>Mon, 06 Sep 2021 06:17:31 +0000</pubDate>
      <link>https://dev.to/ayenyeinsan/how-to-go-back-directory-in-nodejs-gg3</link>
      <guid>https://dev.to/ayenyeinsan/how-to-go-back-directory-in-nodejs-gg3</guid>
      <description>&lt;p&gt;If you are new to Nodejs , you may not know how to use file module completely. I hope this article may help you to find out ways to create better application with Nodejs. &lt;/p&gt;

&lt;p&gt;Nodejs is really fast than other languages' processing .All javascript lovers are now fall in love with nodejs because of its non-blocking feature and robust architecture .&lt;/p&gt;

&lt;p&gt;Today ,I am going to show you how we can go back file directory in nodejs . Now ,we will log in console to know where we are running ,using&lt;code&gt;__dirname&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//current directory where we open this folder.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we get our current directory but you are trying to move your directory &lt;em&gt;one&lt;/em&gt; step back.You must use nodejs built in module &lt;code&gt;path&lt;/code&gt; to work with directories. The method &lt;code&gt;path.join()&lt;/code&gt; execute several segments into one path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;oneStepBack&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;oneStepBack&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//move one step back from current directory&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;If you want to move two step backward from current  working directory, the code will be like this...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;twoStepBack&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../../&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;twoStepBack&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//move two step back from current directory&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Happy coding!!&lt;/p&gt;

</description>
      <category>language</category>
      <category>node</category>
      <category>file</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
