<?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: Ayotunde Ogele</title>
    <description>The latest articles on DEV Community by Ayotunde Ogele (@rolxmehh).</description>
    <link>https://dev.to/rolxmehh</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%2F1137978%2F42a71c5d-6f53-4795-9374-8844c697906c.jpeg</url>
      <title>DEV Community: Ayotunde Ogele</title>
      <link>https://dev.to/rolxmehh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rolxmehh"/>
    <language>en</language>
    <item>
      <title>Effective State Management with Context API in React</title>
      <dc:creator>Ayotunde Ogele</dc:creator>
      <pubDate>Fri, 01 Sep 2023 08:00:13 +0000</pubDate>
      <link>https://dev.to/rolxmehh/effective-state-management-with-context-api-in-react-51l7</link>
      <guid>https://dev.to/rolxmehh/effective-state-management-with-context-api-in-react-51l7</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
State management is a crucial aspect of building modern web applications, and React provides various tools to help developers manage state efficiently. One such tool is the Context API, a built-in solution that simplifies the process of sharing state across components. In this article, we'll dive into the world of state management with the Context API in React. Whether you're new to React or an experienced developer, this comprehensive guide will help you harness the power of the Context API to create scalable and maintainable applications.&lt;br&gt;
Prerequisite: Basic understanding of state and props in react.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table of Contents:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is State Management?&lt;/li&gt;
&lt;li&gt;Understanding Context API&lt;/li&gt;
&lt;li&gt;Setting Up Context&lt;/li&gt;
&lt;li&gt;Providing and Consuming Context&lt;/li&gt;
&lt;li&gt;Performance Optimization with Memoization&lt;/li&gt;
&lt;li&gt;Advanced Techniques with Context&lt;/li&gt;
&lt;li&gt;Pros and Cons of Context API&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. What is State Management?&lt;/strong&gt;&lt;br&gt;
Before delving into Context API, let's understand the concept of state management. In a React application, state refers to the data that can change over time and affect the UI rendering. State management involves controlling and maintaining this data in a structured manner to avoid unnecessary complexity and bugs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Understanding Context API&lt;/strong&gt;&lt;br&gt;
Context API is a React feature that provides a way to share data across components without manually passing props down the component tree. &lt;br&gt;
Imagine a situation where you have to create a state that is to be consumed in many components that are not direct children of the parent component; to accomplish this, you will need to convey the state through intermediary components, which will result in prop drilling.&lt;/p&gt;

&lt;p&gt;Context API eliminates the need to pass this state data through intermediate components, and makes the data available in the components where it's needed, making the codebase cleaner and more maintainable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Setting Up Context&lt;/strong&gt;&lt;br&gt;
To start using Context API, you first need to create a context. In your React application, create a new file (e.g., MyContext.js) to define the context:&lt;br&gt;
&lt;/p&gt;

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

const MyContext = createContext();

export default MyContext;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Providing and Consuming Context:&lt;/strong&gt;&lt;br&gt;
Once the context is defined, you can provide and consume the context using the Provider and useContext hooks, respectively. Let's create a simple example where a User component sets and consumes user data in the context.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// App.js
import {useState} from 'react';
import MyContext from './MyContext';
import User from './User';

function App() {
  const [username, setUsername] = useState("")

  return (
    &amp;lt;MyContext.Provider value={username, setUsername}&amp;gt;
      &amp;lt;User /&amp;gt;
    &amp;lt;/MyContext.Provider&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// User.js
import { useContext } from 'react';
import MyContext from './MyContext';

const User = () =&amp;gt; {
  const {username, setUsername} = useContext(MyContext);

  return (
     &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Welcome, {username}!&amp;lt;/h1&amp;gt;

      &amp;lt;button onClick={() =&amp;gt; setUsername("Roland")}&amp;gt;
       Click me
      &amp;lt;/button&amp;gt;
     &amp;lt;/div&amp;gt;
  );
}

export default User;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Performance Optimization with Memoization:&lt;/strong&gt;&lt;br&gt;
To prevent unnecessary re-renders, you can use the useMemo hook to memoize components that consume context. This ensures that a component only re-renders when its props or context values change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Advanced Techniques with Context:&lt;/strong&gt;&lt;br&gt;
Context API can be extended with advanced techniques like using multiple contexts, composing contexts, and lazy initialization. These techniques enable you to create modular and flexible state management solutions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Pros and Cons of Context API:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Simplicity:&lt;/strong&gt; Context API simplifies state sharing and reduces prop drilling.&lt;br&gt;
Global State: Easily manage global state without relying on external libraries.&lt;br&gt;
&lt;strong&gt;Built-in:&lt;/strong&gt; No need to install additional packages, as Context API is part of React.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Not for All State:&lt;/strong&gt; Context API is best suited for global state and not recommended for local component state.&lt;br&gt;
&lt;strong&gt;Performance:&lt;/strong&gt; Context updates can cause unnecessary re-renders if not optimized.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
The Context API in React provides an effective way to manage state and share data across components. It's a versatile tool that caters to projects of all sizes, from simple to complex. By understanding the principles of the Context API and applying the techniques covered in this article, you can create well-structured and efficient React applications that scale seamlessly. Whether you're a beginner or an experienced developer, mastering the Context API will empower you to build better user experiences with confidence.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Maximizing React Component Efficiency with the useRef Hook</title>
      <dc:creator>Ayotunde Ogele</dc:creator>
      <pubDate>Tue, 22 Aug 2023 11:23:00 +0000</pubDate>
      <link>https://dev.to/rolxmehh/maximizing-react-component-efficiency-with-the-useref-hook-32ck</link>
      <guid>https://dev.to/rolxmehh/maximizing-react-component-efficiency-with-the-useref-hook-32ck</guid>
      <description>&lt;p&gt;In the realm of React development, achieving optimal performance and maintaining a seamless user experience ranks as a top priority. The useRef hook emerges as a versatile and powerful tool that can significantly contribute to achieving these goals. In this article, we will explore the various use cases of the useRef hook, delve into its distinctions and similarities with the useState hook, and identify instances where it stands as the ideal choice for your React applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table of Contents&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Introduction to the useRef Hook&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unveiling the useRef hook's role&lt;/li&gt;
&lt;li&gt;Practical applications of the useRef hook&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.Comparing useRef and useState&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identifying shared traits of useRef and useState&lt;/li&gt;
&lt;li&gt;Highlighting the key differences between useRef and useState&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.Determining the Ideal Scenarios for the useRef Hook&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Direct manipulation and engagement with DOM elements&lt;/li&gt;
&lt;li&gt;Storing data that is not displayed on the user interface&lt;/li&gt;
&lt;li&gt;Preventing unnecessary re-renders for an optimized user experience&lt;/li&gt;
&lt;li&gt;Elevating component performance through effective utilization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4.Illustrating Usage: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a persistent input field with the useRef hook&lt;/li&gt;
&lt;li&gt;Auto-Scrolling in a Chat Interface&lt;/li&gt;
&lt;li&gt;Handling Focus and Text Selection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5.Best Practices and Considerations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrating useRef with the ref attribute for seamless DOM manipulation&lt;/li&gt;
&lt;li&gt;Using useRef's mutability for direct data updates&lt;/li&gt;
&lt;li&gt;Ensuring consistent data retrieval practices for readability and reliability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;6.Conclusion&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Introduction to the useRef Hook&lt;/strong&gt;&lt;br&gt;
The useRef hook allows React components to create mutable references to elements or values. Unlike useState, which primarily manages state for rendering purposes, useRef focuses on the creation of references that persist across re-renders without triggering user interface updates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical Applications of useRef&lt;/strong&gt;&lt;br&gt;
The useRef hook is useful in a variety of scenarios, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Direct manipulation and interaction with DOM elements&lt;/li&gt;
&lt;li&gt;Storage of data not intended for rendering on the user interface.&lt;/li&gt;
&lt;li&gt;Minimization of unnecessary re-renders while maintaining data integrity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Comparing useRef and useState&lt;/strong&gt;&lt;br&gt;
Making wise choices about using useRef and useState requires a thorough knowledge of their similarities and differences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shared Traits between useRef and useState&lt;/strong&gt;&lt;br&gt;
Both hooks serve as repositories for data storage within React components. Consider the following example, where the goal is to store a name value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Import {useState, useRef} from "react"

// Using useState
const [name, setName] = useState('Roland');

// Using useRef
const nameRef = useRef('Roland');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key Distinctions between useRef and useState&lt;/strong&gt;&lt;br&gt;
Although both hooks involve data storage, their behaviour and application diverge notably:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Re-rendering:&lt;/strong&gt; The useState hook causes a re-render whenever changes are made to the stored data. useRef, on the other hand, does not prompt re-renders, making it perfect for the storage of data unrelated to the user interface.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Mutation:&lt;/strong&gt; Direct alteration of the stored state is prohibited in the context of useState; instead, the setter function must be used. In contrast, useRef allows for direct modification of stored values. useRef returns an object with a single property called &lt;em&gt;current&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Value Access:&lt;/strong&gt; The stored state variable must be accessed in order to retrieve data from useState. In the case of useRef, the &lt;em&gt;current&lt;/em&gt; property provides access to the stored value.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Cases:&lt;/strong&gt; useState is best suited for data that affects how the user interface is rendered. useRef, on the other hand, excels at managing DOM manipulation and storing data for non-rendering purposes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Determining the Ideal Scenarios for the useRef Hook&lt;/strong&gt;&lt;br&gt;
The useRef hook excels in a variety of situations where its unique qualities give it a competitive edge:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct Manipulation of DOM Elements&lt;/strong&gt;&lt;br&gt;
The useRef hook stands out as the best option whenever direct interaction with DOM elements is necessary, such as to control focus, start animations, or gather data. Direct access to DOM elements is possible by utilizing the useRef function with the &lt;em&gt;ref&lt;/em&gt; attribute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concealed Storage of Non-UI Data&lt;/strong&gt;&lt;br&gt;
useRef performs exceptionally well for data that needs to be persistent across re-renders but is hidden from the user interface. useRef offers a dependable mechanism, whether it involves caching computed values or storing previous states for comparative analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mitigating Unnecessary Re-renders&lt;/strong&gt;&lt;br&gt;
The effectiveness of useRef is made clear in situations where data updates must occur without triggering re-renders. Data stored using useRef evades the activation of component updates, facilitating efficient management of data that undergoes frequent changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimization of Component Performance&lt;/strong&gt;&lt;br&gt;
Superfluous calculations and rendering cycles can be avoided by carefully utilizing useRef to store important data that does not affect rendering. This optimization helps to ensure seamless user experiences and a higher level of performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Illustrating Usage: Creating a Persistent Form Input&lt;/strong&gt;&lt;br&gt;
To demonstrate the utility of the useRef hook, let us create a persistent form input field that retains its value across re-renders:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useRef } from 'react';

const PersistentInput = () =&amp;gt; {
  const inputRef = useRef(null);

  const handleButtonClick = () =&amp;gt; {
    const inputValue = inputRef.current.value;
    console.log('Input Value:', inputValue);
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;input ref={inputRef} type="text" /&amp;gt;
      &amp;lt;button onClick={handleButtonClick}&amp;gt;Log Input Value&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Auto-Scrolling in a Chat Interface&lt;/strong&gt;&lt;br&gt;
Consider a chat interface where new messages are constantly added. To ensure users are always presented with the latest message, we can leverage useRef to auto-scroll the chat container to the bottom each time a new message arrives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useRef, useEffect } from 'react';

const ChatInterface = ({ messages }) =&amp;gt;{
  const chatContainerRef = useRef(null);

  useEffect(() =&amp;gt; {
    scrollToBottom();
  }, [messages]);

  const scrollToBottom = () =&amp;gt; {
    if (chatContainerRef.current) {
      const chatContainer = chatContainerRef.current;
      chatContainer.scrollTop = chatContainer.scrollHeight;
    }
  };

  return (
    &amp;lt;div className="chat-container" ref={chatContainerRef}&amp;gt;
      {messages.map((message, index) =&amp;gt; (
        &amp;lt;div key={index} className="message"&amp;gt;
          {message.text}
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Handling Focus and Text Selection&lt;/strong&gt;&lt;br&gt;
Using useRef can make it easier to control focus and text selection in a component. For instance, we use useRef to focus on an input element when a button is clicked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useRef } from 'react';

const  FocusExample = () =&amp;gt; {
  const inputRef = useRef(null);

  const handleButtonClick = () =&amp;gt; {
    inputRef.current.focus();
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;input ref={inputRef} type="text" /&amp;gt;
      &amp;lt;button onClick={handleButtonClick}&amp;gt;Focus Input&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Best Practices and Considerations&lt;/strong&gt;&lt;br&gt;
To optimize the utilization of the useRef hook:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Seamlessly integrate the &lt;em&gt;ref&lt;/em&gt; attribute with useRef for fluid DOM manipulation.&lt;/li&gt;
&lt;li&gt;Capitalize on the mutability enabled by useRef for direct data updates.&lt;/li&gt;
&lt;li&gt;Uphold a consistent approach to data retrieval by invariably employing &lt;em&gt;.current&lt;/em&gt; for the retrieval of stored values.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Conclusion&lt;/strong&gt;&lt;br&gt;
The useRef hook is a powerful and versatile tool in the React developer's toolkit. Its ability to persistently store mutable values across renders, interact with the DOM directly, and optimize performance by avoiding unnecessary re-renders makes it an essential resource for a wide range of scenarios. Whether it's for accessing and manipulating DOM elements, managing previous values without triggering re-renders, or even implementing animations and custom hooks, useRef offers a flexible solution that enhances the efficiency and functionality of React components. By understanding its use cases and limitations, developers can harness the full potential of the useRef hook to create more efficient, interactive, and performant applications.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A guide to Next.js app routing system</title>
      <dc:creator>Ayotunde Ogele</dc:creator>
      <pubDate>Tue, 15 Aug 2023 11:45:29 +0000</pubDate>
      <link>https://dev.to/rolxmehh/a-guide-to-nextjs-app-routing-system-5gn</link>
      <guid>https://dev.to/rolxmehh/a-guide-to-nextjs-app-routing-system-5gn</guid>
      <description>&lt;p&gt;&lt;a href="https://media.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%2F3nudic96awfd67ltlfdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3nudic96awfd67ltlfdd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
One of the primary benefits of using Next.js is the ease with which it handles routing and navigation. As opposed to react-router DOM, where you would have to set up routes for your application, Next.js makes it simple by implementing a file-based routing system.&lt;br&gt;
In this article, we will talk about how routes are structured in the app router, as well as route grouping, nesting, and dynamic routes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisite:&lt;/strong&gt; This article requires that you have a basic understanding of what routing is and how it works in applications. Please take note that the examples in this article use Typescript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next.js App router&lt;/strong&gt;&lt;br&gt;
The app router is a feature that Next.js introduced in version 13, which provides more room to organise and streamline the process of managing routes in our application.&lt;br&gt;
With the app router, we simply create folders (which are going to be the route names) inside the app directory, and inside each folder, we create the &lt;em&gt;page.tsx&lt;/em&gt; file, this indicates to Next.js that this is a route. The &lt;em&gt;page.tsx&lt;/em&gt; file inside the app root folder is rendered as the homepage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nesting using the app router&lt;/strong&gt;&lt;br&gt;
The app router allows us to create nested routes by adding additional folders inside the original folder.&lt;br&gt;
Let us take the &lt;em&gt;about&lt;/em&gt; route as an example.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F46ghca1xs8scbamxpfxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F46ghca1xs8scbamxpfxw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we navigate to the &lt;em&gt;/about&lt;/em&gt; route in our browser, this &lt;em&gt;page.tsx _file will be rendered because we created a folder called about and a _page.tsx&lt;/em&gt; file inside of it.&lt;/p&gt;

&lt;p&gt;Now let's create two more folders inside the &lt;em&gt;about&lt;/em&gt; folder, namely &lt;em&gt;us&lt;/em&gt; and &lt;em&gt;our-service&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fin122k72ke4ajwzk105o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fin122k72ke4ajwzk105o.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The respective paths we created for them would be rendered when we navigate to the &lt;em&gt;/about/us&lt;/em&gt; and &lt;em&gt;/about/our-service&lt;/em&gt; routes in the browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Route grouping&lt;/strong&gt;&lt;br&gt;
We can also organise routes in the app router by simply enclosing the top-level folder in parentheses. With this command, Next.js is instructed not to include the wrapped name in the route.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fqb8jafi99ivy08ume5d7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fqb8jafi99ivy08ume5d7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We added a folder named &lt;em&gt;auth&lt;/em&gt;, which is wrapped in parentheses, to the app directory and then created &lt;em&gt;login&lt;/em&gt; and &lt;em&gt;signup&lt;/em&gt; folders inside of it. Enclosing the folder in parentheses removes _auth _from the route name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dynamic route&lt;/strong&gt;&lt;br&gt;
A dynamic route is a feature that enables us to create pages with dynamic segments in the URL paths. This is helpful when we want to create pages that have a similar structure but different content depending on the values in the URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fjbg5jxkxbt437ubpytwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fjbg5jxkxbt437ubpytwb.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
To create a dynamic route, the folder name is enclosed in square brackets [] within the app directory or inside the route folder we want to fetch dynamic data for, and a &lt;em&gt;page.tsx&lt;/em&gt; file is then created inside the enclosed folder. The name inside the brackets corresponds to the parameter we want to capture from the URL. For instance, in the image above, we added a folder called [id] in the app directory, which denotes that this page will use the "id" dynamic route parameter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Next.js version 13 introduced the powerful app router feature, which allows developers to create organised routes and nested routes flexibly. This feature streamlines the way we structure our application's routes, making navigation and organisation more intuitive.&lt;br&gt;
PLEASE FOLLOW FOR MORE CONTENT.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>nextjs</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
