Pre-Fill Profile Form from DB (MySQL) | Edit Applicant Data – Next.js + RHF

Pre-Fill Profile Form from DB (MySQL) | Edit Applicant Data – Next.js + RHF

T
Thapa Technical
Mar 1, 2026

📂 Source Code
👉 GitHub Repo: https://github.com/thapatechnical/job-portal-nextjs
----------------------------------------------------------------------------------

In this video, we will build a real-world feature in our Job Portal Application — automatically pre-filling the applicant profile form if data already exists in the database.

When a user logs in for the first time, the profile form will be empty.
But once they submit their details, we will fetch the saved data from MySQL and pre-fill the form using React Hook Form.

This makes editing profile details easy and professional — just like real production applications.

You’ll learn:

• How to fetch existing data from MySQL
• How to return the data properly from a server function
• How to pass data as props
• How to define TypeScript types for props
• How to use defaultValues in React Hook Form

This is a must-know feature for every full-stack developer building real-world applications.
------------------------------------------------------------------------------------
🔗 Useful Playlists

📘 Next.js Full Stack Playlist:
https://youtube.com/playlist?list=PLwGdqUZWnOp0lwvSBaIzzgV9X0ZiZ-42O&si=aQ_TNBNNx5L7V_bn

⚛️ React.js Playlist:
https://youtube.com/playlist?list=PLwGdqUZWnOp1Rab71vx2zMF6qpwGDB2Z1&si=sDZRxsYNetYmojKd

💻 TypeScript Playlist:
https://youtube.com/playlist?list=PLwGdqUZWnOp0xfHQFmlL52b_6-QZ0mnk_&si=c4jfsd5ElDC1p0A5
------------------------------------------------------------------------------------
💸 Get All My YouTube Videos' Source Code for just ₹199! Grab Now - https://thapatechnical.shop/source-code

📺 Watch the complete Node.JS Playlist here :https://youtube.com/playlist?list=PLwGdqUZWnOp3KELplHtc-RnJ5xTUPqdgH&si=_ob8F88HYxCdspup

🔥 Access Source Code, PPT & Notes here for Free : https://www.thapatechnical.com/2024/11/introduction-to-nodejs.html
------------------------------------------------------------------------

🚀 Boost Your Skills with these Pre-Requisite Videos:

🔗 Best HTML Course - https://youtu.be/5ccq_nLHneE
🔗 Best CSS Course - https://youtu.be/MSICFljRcb4
🔗 JavaScript Basics Course Part 1 - https://youtu.be/13gLB6hDHR8
🔗 JavaScript Advanced Course Part 2 - https://youtu.be/YwsOCN8woA8

------------------------------------------------------------------------
💸 Build Your Own E-commerce Website for Free! - https://www.thapatechnical.com/2024/03/build-complete-ecommerce-website-using.html

------------------------------------------------------------------------
✌️ Join Us!

🚀 Become a Member: Unlock perks, free source code, and more Join Now : https://www.youtube.com/channel/UCwfaAHy4zQUb2APNOGXUCCA/join
📷 Connect on Instagram: https://www.instagram.com/thapatechnical
🗨️ Join Our Discord Server: Hang out with fellow programmers Discord Link: https://discord.gg/MdScmCsua6

------------------------------------------------------------------------

⌛TIMELINE⏳
0:00 Intro – Why Pre-Fill Profile Forms Matter
1:25 Support the Channel ❤️
2:10 Step 1 – Create Function to Fetch Applicant Data
2:40 Step 2 – Pass Data as Props to Component
3:05 Writing Function to Get Prefilled Data from MySQL
6:10 Returning Data Properly from Server Function
7:15 Passing Returned Data as Props
7:40 Using defaultValues in React Hook Form (Client Side)
8:02 Defining TypeScript Props Types
11:00 Quick Recap – What We Built
12:05 What’s Coming in Next Video