Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

URL shortening API landing page using Reactjs and Tailwindcss

@jomefavourite

Desktop design screenshot for the URL shortening API landing page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


I love feedback on how I implemented some functionalities using React, are they the best practices?

Community feedback

Katie 405

@kem522

Posted

Hi Jome, this is great!

Your use of hooks, especially useRef which is a bit of a confusing concept in my opinion, are excellent.

Here are a couple of suggestions:

  1. This is mostly personal preference, but in your Main.js you save the result of stats.map to a variable and then use that in the body of the component whereas I think most developers that I've worked with would expect to see that stats.map directly in the body of the component. I think it is every so slightly more performant as it saves having to use that extra bit of memory for the variable.

  2. In Nav.js you set an eventListener in the component but I would do this in your useEffect hook and then use that same hook to clean it up. If you don't clean up listeners like this they can stick around when your component gets destroyed eating up memory and could get set again and again if your component gets re-rendered. Here is an article that explains a little more about that.

I would highly recommend looking into styled components for your CSS next time you use React. They work really well together and are a lot of fun to use!

Keep it up!

2

@jomefavourite

Posted

Thanks @kem522 for the suggestions.

I'll try setting the event listener into useEffect and cleaning it up.

I just started looking into styled components yesterday, it seems very promising.

0
P
ApplePieGiraffe 30,545

@ApplePieGiraffe

Posted

Hi there, Jome Favourite! 👋

Nice to see you complete another challenge! 😀 Amazing work on this one! 👍 Your attention to detail has been great for this challenge and everything looks good and responds very nicely! 👏

I'm afraid I can't offer much advice about using React (yet) since I'm just getting into it myself. 😅

But regardless, keep coding (and happy coding, too), of course! 😁

1

@jomefavourite

Posted

Thanks @ApplePieGiraffe for always giving a feedback 😊

1

Please log in to post a comment

Log in with GitHub
Discord logo

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