Routing Segments in Next Js

  • Add Segments in Routing, Folder Structure just like:
  • Code for src/app/contact/[...person]/page.js file:


    "use client"
    import React from 'react'

    const page = (props) => {
        console.log("params", props)
        return (
            <div>
                person segments
            </div>
        )
    }

    export default page

  • We make this type of url segments:
http://localhost:3000/contact/gagan/aggarwal
http://localhost:3000/contact/rohit/kumar
http://localhost:3000/contact/priya/singh
http://localhost:3000/contact/abc/dfe/rt/d/dsdf/gff/x/de

No comments:

Post a Comment

Debouncing and Throttling in JavaScript

Debouncing and Throttling - Made Simple! Think of these as traffic controllers for your functions: Debouncing = Wait until user stops, ...