0
import {Suspense} from "react" 

type Props = {  
    params: Promise<{joblistingId: string }> 
}
export default function JoblistingPage(props: Props) { 
    return ( 
        <Suspense> 
            <SuspendedPage (...props) /> 
        </Suspense> 
    ) 
}
async function SuspendedPage({params}: Props) { 
    const {jobListingId} = await params 
    const joblisting = await getJoblisting(joblistingId)
}

in this we are awaiting params which are promise.why it is passed down as promise?

New contributor
Ujjawal Bindal is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

2 Answers 2

0

Not sure if I correctly understand your question, but params was already defined as a promise to begin with, thus no matter if you drill it down to the next component or not, it's still going to be a promise. (Regardless of whether you use Suspense or not.)

Sign up to request clarification or add additional context in comments.

Comments

0

Next.js 15+ makes params a Promise so the page can render and stream immediately without waiting for the dynamic segment to resolve.

You pass the unresolved Promise down and wrap the child in <Suspense> because:

  • The parent stays synchronous → starts streaming right away.

  • The child (async SuspendedPage) does await params → suspends safely.

  • React shows the Suspense fallback until the promise resolves, then streams in the real content.

That’s how Next.js achieves non-blocking, progressive rendering instead of waiting for everything upfront.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.