Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Make account pages with unique links in Next JS

So I've been trying to make a website that would include user pages that displays their posts and other info. I'm not sure how to create new links to their accounts. For example, if a user had a UID of 121212, you could access his account information at https://www.example.com/users/121212/. Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to create new file in pages/users/[UID].js.

When https://www.example.com/users/121212/visit this url pages/users/[UID].js this file call.

When https://www.example.com/users/{anotherId} visit the url also pages/users/[UID].js this file call.

In users page code

import Link from 'next/link'

function Users() {
  return (
    <ul>
      <li>
        <Link href="/Users/abc">
          <a>Go to pages/post/[pid].js</a>
        </Link>
      </li>
      <li>
        <Link href="/Users/abc?foo=bar">
          <a>Also goes to pages/post/[pid].js</a>
        </Link>
      </li>
    </ul>
  )
}

export default Users

And in users/[UID].js file;

import { useRouter } from 'next/router'

    const Post = () => {
      const router = useRouter()
      const { UID} = router.query
    
      return <p>Post: {UID}</p>
    }
    
    export default Post

For more help dynamic-routes

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!