Implementing a page to create a new ticket
We’ll now create a page that is shown when the Create New Ticket navigation button is clicked.
Since, per our navigation component code, we wanted the ticket creation to be at /tickets/new
, you now have to create the app/tickets/new/page.js
file.
Then, we want to show a form that allows us to set the title and a description for a new ticket – that’s sufficient at the moment, but you can extend the form to allow more input later (such as Urgency, Reference Link, or whatever comes to your mind with regards to ticket management).
We also want frontend functionality, such as onSubmit
, in the ticket creation form, so we’ll certainly need a client component ('use client';
). This time, we will simply make the page itself the client component.
To do this, go to app/tickets/new/page.js
and add the following code:
"use client"; import { useRef } from "react"; export default function...