utkarsh-1602 / ecommerce-admin

This repository provides a comprehensive solution for managing billboards, categories, and products, allowing you to create a customized online shopping experience similar to Shopify. With intuitive features, you can effortlessly design and organize your store as well.
https://ecommerce-admin-mauve-psi.vercel.app
MIT License
2 stars 0 forks source link

Learn and document about why params are extracted in this server side [billboardId]/page.tsx component #31

Closed utkarsh-1602 closed 11 months ago

utkarsh-1602 commented 11 months ago

Why params are extracted like this ?


// this is a server component 

const BillboardPage = async ({
    params
}: {
    params: { billboardId: string }
}) => {

    return (
        <div>
            This is a form for billboard page
        </div>
    )
}

export default BillboardPage
utkarsh-1602 commented 11 months ago

concept used : Object Destructuring

The concept used here is called "object destructuring." In JavaScript, object destructuring allows you to extract properties from objects and bind them to variables in a more concise way. In the provided code snippet, the syntax { params } is an example of object destructuring, where it extracts the params property from the props object.