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

Primitive Types in TypeScript

In TypeScript, primitive types are the most basic data types, and they are the building blocks for handling data. They correspond to simple ...