Page with same content but for a new record vs edit record
Answered
Mourning Dove posted this in #help-forum
Mourning DoveOP
Say I need a page with a form, and there's a
Do you simple have a single page component (
/record/new and a /record/<UUID> version, where one is to create a new record, and one is to edit an existing record. How do you handle this with pages?Do you simple have a single page component (
/record/ in this case) and add a query param for new vs an existing record? Something like/record/?record_id=new/record/?record_id=<uuid>5 Replies
@Mourning Dove Say I need a page with a form, and there's a `/record/new` and a `/record/<UUID>` version, where one is to create a new record, and one is to edit an existing record. How do you handle this with pages?
Do you simple have a single page component (`/record/` in this case) and add a query param for new vs an existing record? Something like
`/record/?record_id=new`
`/record/?record_id=<uuid>`
id use client component to show a modal to create new
Answer
and that component is in layout.tsx of
/recordthat way its always displayed regardless if you visit
/record/1231241ofc you could also do
/record/new if you choose to have a whole page to create new recordMourning DoveOP
Ok, awesome. thanks for your input!