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

PHASE 1 — Topic 4: How Socket.IO Works Internally (Engine.IO, Transports, and Fallback)

We now understand what Socket.IO is and why it is useful. In this post, we go one level deeper and look at what actually happens behind the ...