Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

URL Shortening built with React, TailwindCSS, Vite

react, tailwind-css, vite
Zubair Adham•400
@atmahana
A solution to the URL shortening API landing page challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I did encountered a weird issue.

I have this dynamic styling that I made but it somehow kinda buggy(?) top-${index * 10}

const FEATURES = [
{
id: "1",
title: "Brand Recognition",
...
},
{
id: "2",
title: "Detailed Records",
...
}, 
{
id: "3",
title: "Fully Customizable",
...
}
];
FEATURES.map((feature, index) => (
<li
key={feature.id}
className={`relative top-${index * 10}`}
>
...
</li>
));

By this logic, it supposed to render with the following sequences: [0]top-0 [1]top-10 [2]top-20, but sometimes the second item rendered with the same top position as the first item, but the third item is always rendered correctly. I have checked on TailwindCSS and the top positions are valid util class.

Been debugging this for a while now, and decided to make it render individually instead of dynamically and it works like a charm.

Did I miss anything to make it rendered dynamically properly? Anyone know why and how did this happens?

Thank you!

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 Zubair Adham'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

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

Frontend Mentor

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

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