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

Responsive Github Search Page

#react#sass/scss#bem
Clytax 120

@Clytax

Desktop design screenshot for the GitHub user search app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Questions:

  • How can I catch it if the api call doesn't find a user with that name?
  • Do you like the way I implemented responsive design?
  • I have been struggling with using global state, is Zustand a good package for this?

Community feedback

@fazzaamiarso

Posted

Hello Clytax! Nice solution!

The easiest way to handle the error is by throwing an exception on the response and appending .catch on your promise chain. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch

.then(res => {
if(!res.ok) throw Error('Failed to fetch');  //exception;
return res.json();
}).then().then().catch(error => console.log(error.message) )

I also recommend you to read this article to answer your state question https://kentcdodds.com/blog/application-state-management-with-react

I hope it helps! Cheers!

0

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