<?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: Adam Azuddin</title>
    <description>The latest articles on DEV Community by Adam Azuddin (@damthedev).</description>
    <link>https://dev.to/damthedev</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%2F1078855%2Fee28f526-b772-4dec-a834-8e7bc4c229c6.jpg</url>
      <title>DEV Community: Adam Azuddin</title>
      <link>https://dev.to/damthedev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/damthedev"/>
    <language>en</language>
    <item>
      <title>The Power of State Management in Front-End Web Development: Introducing Zustand</title>
      <dc:creator>Adam Azuddin</dc:creator>
      <pubDate>Fri, 02 Jun 2023 09:03:07 +0000</pubDate>
      <link>https://dev.to/damthedev/the-power-of-state-management-in-front-end-web-development-introducing-zustand-1lap</link>
      <guid>https://dev.to/damthedev/the-power-of-state-management-in-front-end-web-development-introducing-zustand-1lap</guid>
      <description>&lt;p&gt;Hey Coders,&lt;/p&gt;

&lt;p&gt;Today, I want to share with you a realization that has completely transformed my approach to front-end web development: the importance of state management. In this blog post, we'll explore what state is in simple terms, and I'll illustrate its significance through a technical example using a movie list search project I'm currently working on. Moreover, I'll introduce you to Zustand, an alternative to Redux that is beginner-friendly and powerful. So, let's dive in!&lt;/p&gt;

&lt;p&gt;Understanding State: A Simple Explanation&lt;/p&gt;

&lt;p&gt;In the world of front-end development, state refers to the data that changes and affects the behavior of our application. It represents the current condition or snapshot of our user interface at any given moment. Imagine a movie list search application where users can type keywords to find relevant movies. The state of this application would include the user input, the list of movies fetched, and any other relevant data.&lt;/p&gt;

&lt;p&gt;Technical Example: Movie List Search&lt;/p&gt;

&lt;p&gt;To better grasp the concept, let's explore a technical example using a movie list search project. Assume you're building a movie search feature where users can enter keywords and receive a list of movie suggestions in real-time. Once they click on a movie suggestion, you want to redirect them to a movie details page. However, passing the entire JSON object for the movie to the link could be too long and inefficient.&lt;/p&gt;

&lt;p&gt;Enter Zustand: A Simple and Powerful State Management Solution&lt;/p&gt;

&lt;p&gt;At this point, you may have heard of Redux, a popular state management library in the React ecosystem. While Redux offers powerful features and benefits, it can be quite complex, especially for beginners. Instead, I recommend using Zustand, a lightweight state management library with a simple API and minimal boilerplate. You can quickly install Zustand via npm and get started right away.&lt;/p&gt;

&lt;p&gt;Using Zustand in Your Movie List Search Project&lt;/p&gt;

&lt;p&gt;To tackle the movie details page problem in our example, Zustand comes to the rescue. First, install Zustand in your project by running the following command in your terminal:&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 zustand
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, define a global state using Zustand. Create a new file called movieStore.js and import Zustand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import create from 'zustand';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's define our global state using Zustand. In movieStore.js, define a store by calling create() and providing it a store configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const useMovieStore = create((set) =&amp;gt; ({
  selectedMovie: null,
  setSelectedMovie: (movie) =&amp;gt; set({ selectedMovie: movie }),
}));

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

&lt;/div&gt;



&lt;p&gt;In the above code, we define a selectedMovie property in our state, initially set to null. We also define a setSelectedMovie function, which allows us to update the selectedMovie value.&lt;/p&gt;

&lt;p&gt;Now, you can import and use the useMovieStore hook in any component that needs access to the global state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useMovieStore } from './movieStore';

const MovieDetailsPage = () =&amp;gt; {
  const setSelectedMovie = useMovieStore((state) =&amp;gt; state.setSelectedMovie);
  const movie = // Fetch movie details from an API or local storage

  // Handle movie click event
  const handleMovieClick = () =&amp;gt; {
    setSelectedMovie(movie);
    // Redirect to the dynamic route '/details/[movieName]'
  };

  return (
    &amp;lt;div&amp;gt;
      {/* Render movie details */}
      &amp;lt;button onClick={handleMovieClick}&amp;gt;Go to Movie Details&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;In the MovieDetailsPage component, we import the setSelectedMovie function from the useMovieStore hook.&lt;/p&gt;

&lt;p&gt;We also fetch the movie details from an API or local storage and store it in the &lt;code&gt;movie&lt;/code&gt; variable. When the user clicks on the movie, we call the &lt;code&gt;setSelectedMovie&lt;/code&gt; function, passing in the &lt;code&gt;movie&lt;/code&gt; object. This updates the &lt;code&gt;selectedMovie&lt;/code&gt; value in our global state.&lt;/p&gt;

&lt;p&gt;With Zustand, the updated &lt;code&gt;selectedMovie&lt;/code&gt; value will be available to any other component that uses the &lt;code&gt;useMovieStore&lt;/code&gt; hook. This means that when the user is redirected to the movie details page, we can retrieve the selected movie from the global state without having to pass a lengthy JSON object in the URL.&lt;/p&gt;

&lt;p&gt;Conclusion: Planning Ahead for State Management&lt;/p&gt;

&lt;p&gt;Through my movie list search project and the discovery of Zustand, I've come to realize the crucial role state management plays in front-end web development. Properly managing state allows us to efficiently handle data and ensure a smooth user experience. While Redux is a well-known solution, it can be overwhelming for beginners. Zustand offers a beginner-friendly alternative that simplifies state management without sacrificing power and flexibility.&lt;/p&gt;

&lt;p&gt;Remember, before diving into coding, it's essential to plan your state management strategy. Think about the data that will change, the interactions between components, and how you can organize your state to ensure seamless communication and data flow throughout your application. Zustand provides a user-friendly approach to global state management, enabling you to build robust and maintainable applications.&lt;/p&gt;

&lt;p&gt;So, embrace the power of state management and leverage tools like Zustand to make your development journey smoother and more enjoyable. Happy coding!&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building My Movie List Website: A Progress Update</title>
      <dc:creator>Adam Azuddin</dc:creator>
      <pubDate>Fri, 26 May 2023 06:43:57 +0000</pubDate>
      <link>https://dev.to/damthedev/building-my-movie-list-website-a-progress-update-3kin</link>
      <guid>https://dev.to/damthedev/building-my-movie-list-website-a-progress-update-3kin</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;Embarking on a personal project is always an exciting endeavor, and for me, creating a movie list website has been a thrilling journey so far. In this blog post, I want to share my progress and accomplishments, as well as some of the challenges I encountered along the way. With the website already connected to the TMDB API and a handy JavaScript library assisting with the implementation, I'm proud of how far I've come. Let's dive into the details!&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting to the TMDB API:
&lt;/h2&gt;

&lt;p&gt;To provide an extensive collection of movie information, I decided to integrate my website with the TMDB (The Movie Database) API. This API offers a wealth of data, including movie details, ratings, reviews, and much more. By establishing a connection to the API, I gained access to a vast repository of movie-related information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simplifying the Search Functionality:
&lt;/h2&gt;

&lt;p&gt;To enhance the user experience, I utilized a JavaScript library called "themoviedb-javascript-library." This library, available on GitHub at &lt;a href="https://github.com/cavestri/themoviedb-javascript-library"&gt;https://github.com/cavestri/themoviedb-javascript-library&lt;/a&gt;, proved to be a valuable tool. It simplified the implementation of the search functionality, allowing users to easily find movies by title, genre, or any other relevant criteria. With this library, searching for movies became a breeze.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Dynamic Routes:
&lt;/h2&gt;

&lt;p&gt;One of the significant milestones in my project was the creation of dynamic routes. By implementing a dynamic route, "/details/[movieName]," I enabled users to view detailed information about a specific movie. The challenge, however, lay in passing all the JSON data from the movie list into a new page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overcoming JSON Data Challenges:
&lt;/h2&gt;

&lt;p&gt;While the task of transferring all the JSON data from one page to another initially posed a challenge, I found a practical solution. Instead of passing the entire JSON data, I opted to refetch the necessary information by making a call to the TMDB API. By including the movie name as a query parameter and selecting the first JSON data from the list of results, I could ensure the desired movie details were readily available on the new page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upcoming Updates and Enhancements:
&lt;/h2&gt;

&lt;p&gt;With my progress so far, I'm thrilled to share that I'm making great strides towards completing my movie list website. In the upcoming week, I plan to focus on improving the user interface (UI) and merging the home-page branch into the main project. By enhancing the visual appeal and usability of the website, I aim to provide a seamless browsing experience to users.&lt;/p&gt;

&lt;p&gt;Additionally, next week's agenda includes the implementation of functionality to sort and filter movies based on categories. This will enable users to view only movies or TV shows, tailoring their browsing experience to their preferences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;Creating a movie list website has been an exhilarating experience, and I'm delighted with the progress I've made so far. By connecting my website to the TMDB API and utilizing a JavaScript library, I've achieved seamless integration and simplified the search functionality. Overcoming challenges related to passing JSON data and dynamically routing to movie details has been a significant milestone.&lt;/p&gt;

&lt;p&gt;Looking ahead, I'm excited to refine the user interface, merge branches, and introduce new features like sorting and filtering options. Stay tuned for more updates on my movie list website project.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Screenshots
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vmLKiH01--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dq9kzdfrwgqn6vsbcnyj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vmLKiH01--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dq9kzdfrwgqn6vsbcnyj.png" alt="Home Page" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HNzRriWc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hwzxztg1nrf7u4y8oyq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HNzRriWc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hwzxztg1nrf7u4y8oyq.png" alt="Suggestions" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i6FXDBPf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a66eo1ryyh97fhwo4eq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i6FXDBPf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a66eo1ryyh97fhwo4eq8.png" alt="Details Page" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>webdev</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>Hello World!</title>
      <dc:creator>Adam Azuddin</dc:creator>
      <pubDate>Mon, 08 May 2023 10:00:03 +0000</pubDate>
      <link>https://dev.to/damthedev/hello-world-3nm6</link>
      <guid>https://dev.to/damthedev/hello-world-3nm6</guid>
      <description>&lt;p&gt;Greetings fellow developer! I'm Adam from Malaysia and I'm documenting my process of building full-stack projects for my portfolio. Please provide some feedbacks, it would be really helpful to me!&lt;/p&gt;

&lt;h2&gt;
  
  
  My first project
&lt;/h2&gt;

&lt;p&gt;I'm building a movie list full-stack project using NextJS. I firat got this idea while browsing MyAnimeList(yes I've quite a free time) and thought their app was really good! I'm thinking of building a web app with at least these unique functionalities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User can create custom lists and share them through social media like Instagram and Twitter. &lt;/li&gt;
&lt;li&gt;Each movies and episodes on a series can be commented and replied by anyone&lt;/li&gt;
&lt;li&gt;User can view available streaming services where that movies or show is available on their region&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I plan to add those features alongside basic movie list features, like rate a movie, ad to watch list, etc&lt;/p&gt;

&lt;h2&gt;
  
  
  Planning
&lt;/h2&gt;

&lt;p&gt;I create a &lt;a href="https://www.notion.so/templates/gantt-chart"&gt;gantt chart using notion&lt;/a&gt;by using this template. The roadmap last for about 2 months including planning and testing. Here's my &lt;a href="https://torpid-bottom-5ba.notion.site/Movie-List-9dcc32427d664a8cbf6040cba23d45bf"&gt;finished plan&lt;/a&gt; and my progress so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;I hope this project come to live one day and benefit even one more person. This journey sure is a long one but I hope with the support of the tech community I can get there and hopefully others like me too! Let's help each other at least on a very small detail of their coding live!&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
