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

What is Machine Learning?

Imagine you have a friend who is really good at recognizing cats in pictures. You show them lots of cat pictures, and over time, they get be...