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

Countries rest Api app with React, React Router, mobile first

tom 175

@tomsky90

Desktop design screenshot for the REST Countries API with color theme switcher coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
4advanced
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi Guys. any advice on how can I improve my code will be much welcome .

Community feedback

@Skidragon

Posted

Hi @tomsky90, nice job on the dark mode and filtering. I do recommend to setup prettier to format your code to make it look nicer and not worry about formatting code. Also the components need to be simplified more, for example:

const HomePage = ({
    error,
    setError,
    darkMode,
    countriesListData,
    countriesDataForDisplay,
    setCountriesDataForDisplay,
    selectValue, 
    setSelectValue,
    inputValue,
    setInputValue,
}) => {
    return ( 
        <div>
            <Form  
                setError={setError}
                darkMode={darkMode}
                countriesListData={countriesListData}
                countriesDataForDisplay={countriesDataForDisplay}
                setCountriesDataForDisplay={setCountriesDataForDisplay}
                selectValue={selectValue}
                setSelectValue={setSelectValue}
                inputValue={inputValue} 
                setInputValue={setInputValue}
            />

this is like saying in vanilla js land Form(setError, darkMode, countriesListData, countriesDataForDisplay, setCountriesDataForDisplay, selectValue, setSelectValue, inputValue, setInputValue), I as a developer of this re-usable component wouldn't want to deal with. It needs to be more generic of a form. For example:

<Form
isDarkMode={true} //the "is" tells me it's a boolean
data={[]}
onSubmit={() => {
// fetch, set your countries, set errors, and set load here
}}
onInputValueChange={() => {}}
onSelectValueChange={() => {}}

This way you can re-use the component in more than one place.

0

tom 175

@tomsky90

Posted

@Skidragon I thought it was getting a little bit out of control but didn't know how to sort it. Thank you for your advice, I will bare that in mind and try to implement it.

0
P

@besopmac

Posted

This comment was deleted

0

tom 175

@tomsky90

Posted

@besopmac I'm not to sure what you mean.

0
P

@besopmac

Posted

@tomsky90 Nevermind.

0
P
Patrick 14,265

@palgramming

Posted

you might want to work on some hover effects for the cards and the back button but otherwise you have a good start to this

0

tom 175

@tomsky90

Posted

@palgramming thank you for advice. much appreciated :)

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