score:2

Accepted answer
const RatesCard = () => {

    const [rates, setRates] = useState([]);
    useEffect(
        ()=>{
            fetch("https://api.vatcomply.com/rates")
            .then(ratesResponse => ratesResponse.json())
            .then(rates => setRates(rates));
        }
    ,[])


    if(rates.length === 0) {
        return <h1> loading </hi>
     }
    return (
        <div className="rates">
            {Object.keys(rates.rates).map(
                rate => <Button variant="outlined">
                    {rate}
                </Button>
            )}
        </div>
        )

score:-1

  useEffect(() => {
    fetch('https://api.vatcomply.com/rates')
      .then((ratesResponse) => ratesResponse.json())
      .then(({ rates }) => setRates(rates));
  }, []);

Related Query

More Query from same tag