Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 8 months ago

Social Links Profile using React

react
Hart Selwyn•120
@hartselwyn
A solution to the Social links profile challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I haven't worked with React for a while now, I am proud I can still do this, I'll be using Vue next time I believe that's what I'll do differently next time

What challenges did you encounter, and how did you overcome them?

Here are some challenges I encountered while working on this React project: Importing Images in React Initially, I encountered issues with importing images from outside the src folder in my React project. React restricts imports to the src directory, causing errors when trying to use relative paths to import images from other locations.

Solution: I resolved this by following React's best practices and ensuring all images were moved into the src folder. I also used dynamic imports when needed, which helped keep the project structure organized.

Handling Image as an Icon Another challenge was trying to use a PNG image as an icon. I had been using React Icons for social media links but wanted to include custom PNG images as part of the UI.

Solution: I solved this by importing the PNG image as a module and applying it as a background or src in a tag, ensuring the image is displayed properly while adhering to React’s file import requirements.

Centering and Positioning UI Elements Aligning and positioning elements such as the social media card in the center of the screen was tricky. The card wasn't correctly aligned vertically and had issues when resizing the page.

Solution: I utilized CSS Flexbox and Grid to easily center the content. By using display: flex, align-items: center, and justify-content: center, I was able to horizontally and vertically center the card, ensuring responsiveness.

Managing State and Dynamic Content Dynamically rendering social media links with icons was straightforward, but I needed a way to make sure the data (URLs and icons) was organized and easily maintainable.

Solution: I used JavaScript arrays and map() to loop through social media links, rendering each one dynamically. I also made sure the JSX was organized for maintainability and readability.

Handling CSS Transitions and Hover States Implementing smooth hover effects on the social media links and the profile image was essential for user interaction, but I wasn’t sure how to apply transitions correctly.

Solution: I added CSS transitions using transition: all 0.3s ease; to create smooth hover effects, which enhanced the user experience. The transitions applied to color changes, scaling of icons, and smooth adjustments on hover.

By addressing these challenges with a clear understanding of React, CSS, and best practices, I was able to deliver a responsive and user-friendly UI. Each obstacle provided an opportunity to improve my problem-solving skills and strengthen my proficiency in front-end development.

What specific areas of your project would you like help with?

Complex Image Handling in React

Managing images, especially from different folders and ensuring they display correctly within the src directory. Optimizing images for web use, such as resizing, compression, or using responsive image formats. Managing Dynamic Data (Social Media Links)

If you plan to extend the project or handle dynamic data (e.g., fetching social media links from an API), it would be helpful to manage that data more effectively using React state or context. Using map() correctly for dynamic content and ensuring data is well-structured for scalability. CSS Positioning and Layouts

While you managed to center elements with Flexbox and Grid, you may want further clarification on advanced layouts or dealing with complex grids and responsive design. Fine-tuning the layout for different screen sizes or working with media queries for responsive designs. Image as Icons and Custom Assets

If you want to implement custom icons or images, especially as interactive elements or to make them look consistent across different devices, help with this can ensure you’re following best practices. Optimizing custom images as icons (e.g., using SVG for scalability). CSS Transitions and Animations

Implementing smooth hover transitions or animations could be expanded to include more complex visual effects or improve performance. Understanding how CSS transitions work across various browsers and how to implement them effectively. Optimizing React Project Structure

As your project grows, it's easy to run into issues with maintaining a clean and scalable file structure. Organizing components, assets, and styles could be areas for further improvement. Understanding React’s lifecycle methods and hooks (like useState and useEffect) can help manage more complex state and side effects. Error Handling and Debugging

React's error messages can sometimes be vague, so understanding how to effectively debug issues, especially with component rendering or props passing, can help you become more efficient. Handling errors gracefully in user-facing components.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Hart Selwyn's solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.