Day 13 Progress Journal: Making the Profile Page Dynamic (MERN Stack Instagram Clone)
Akash Singh
Posted on November 20, 2024
Today, we reached an exciting milestone by enhancing the profile page, transforming it from a static display into a dynamic and personalized experience. This upgrade involved linking the backend with the frontend and using dummy data stored in the database to mimic real user information.
We kicked off the session by filling the database with the dummy data from the seedpost.js
file. This step was essential for creating a realistic environment where user profiles and posts could be fetched dynamically. I developed a script to efficiently insert the seed data into the database, ensuring it matched the required schema and structure.
On the backend, I set up an API endpoint to fetch the seeded data based on a specific user ID. This endpoint was crafted to be both secure and efficient, utilizing query parameters to filter the data for individual profiles. After implementation, I conducted thorough testing to confirm that the API returned accurate and relevant information.
Shifting to the frontend, I modified the Profile Page component to make API calls and display the retrieved data in real-time. Key elements of the profile, including the username, profile picture, bio, and posts, were updated to showcase the dummy data from the database. I also styled the posts grid to ensure it was responsive, providing a clean and attractive layout across different devices.
Adopting a test-driven development (TDD) approach, I validated the profile functionality by simulating various scenarios, such as users without posts or incomplete profiles. Debugging these situations helped enhance the logic for a more reliable implementation.
By the end of the session, the profile page was fully dynamic, setting the stage for integrating real-time user data in upcoming milestones. Next, I plan to connect the profile to the authentication system, allowing for live updates based on logged-in users.
Posted on November 20, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.