,

Creating a Contact Form for a Portfolio Website using Next JS 13 and APP route

Posted by

Next JS 13 Contact Form using APP route – portfolio website

The Next JS 13 Contact Form using APP route – portfolio website

Next.js is a popular React framework for building server-side rendered applications. With the release of Next.js 13, creating a contact form for your portfolio website has become even easier with the APP route feature.

Using the APP route feature, you can create dynamic routes in your Next.js app by creating a function that returns a custom component. This allows you to easily build a contact form page that can handle form submissions without having to create a separate route or page.

Here’s how you can create a contact form using the APP route feature in your Next.js 13 portfolio website:

  1. Create a new component for your contact form, such as ContactForm.js
  2. Inside ContactForm.js, create a form component using HTML and add input fields for the user to enter their name, email, subject, and message. You can also add a submit button to handle form submissions.
  3. Next, create a function that returns the ContactForm component in your app’s pages directory. This function will be used to create the dynamic route for your contact form page.
  4. Within the function, use the useRouter hook from Next.js to access the router object and create a handleSubmit function to handle form submissions.
  5. Finally, use the APP Route feature to create a dynamic route for your contact form page and provide a path for users to access the contact form on your portfolio website.

By following these steps, you can easily create a dynamic contact form for your Next.js 13 portfolio website using the APP route feature. This makes it easier for users to get in touch with you and provides a seamless experience for managing form submissions.

Overall, the new Next.js 13 APP route feature makes it even easier to create dynamic routes and handle form submissions in your portfolio website. With its streamlined process and improved flexibility, building a contact form has never been easier.

0 0 votes
Article Rating
14 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@rivasativa
11 months ago

thank you, thank you, thank you…its easy to pay attention to such a gorgeous woman, you save my day.

@mrawesome1821
11 months ago

For some weird reason I had to format my form data like this:

const data = {
floating_first_name: e.target.elements.floating_first_name.value,
floating_last_name: e.target.elements.floating_last_name.value,
floating_email: e.target.elements.floating_email.value,
message: e.target.elements.message.value,
};

Do you know why?

@geminiatwork
11 months ago

Hello, thanks for the tutorial. How to send attachment via file input? Does it works with App Router?

@nicolasvalenzuela7204
11 months ago

What would you recommend to put this portfolio online?

@aygunbayir
11 months ago

I'm learning many best practices from you, thanks! 😊

@akhila5858
11 months ago

Can you please make a full course on next js

@rohitsinghkhetwal1471
11 months ago

😍

@kritsana6170
11 months ago

Thank you, It's very nice video. 😊

@theviperxxsy1041
11 months ago

Very nice and nice video

@MarcialIgme
11 months ago

🤩

@AudioMulch4
11 months ago

There is late night but also can be called early morning now! Glad to watch your new video and, good morning for you! 💜❤️😉

@hwangblood
11 months ago

thanks for your efforts

@dipeshdas3
11 months ago

🎉🎉🎉🎉

@vikashkhati007
11 months ago

Give me heart 🤥