Update 23_fetching_data_using_hooks.md

The Country name and flag are not displayed correctly. so, specify the type of name to display and updated the version of the API link.
pull/323/head
Priyanshu Garg 2 years ago committed by GitHub
parent 8b41cd49c3
commit 327df3bda2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,13 +36,13 @@ import React, { useState, useEffect } from 'react'
import axios from 'axios'
import ReactDOM, { findDOMNode } from 'react-dom'
const Country = ({ country: { name, flag, population } }) => {
const Country = ({ country: { name, flags, population } }) => {
return (
<div className='country'>
<div className='country_flag'>
<img src={flag} alt={name} />
<img src={flags.png} alt={name.common} />
</div>
<h3 className='country_name'>{name.toUpperCase()}</h3>
<h3 className='country_name'>{name.common.toUpperCase()}</h3>
<div class='country_text'>
<p>
<span>Population: </span>
@ -62,7 +62,7 @@ const App = (props) => {
}, [])
const fetchData = async () => {
const url = 'https://restcountries.eu/rest/v2/all'
const url = 'https://restcountries.com/v3.1/all'
try {
const response = await fetch(url)
const data = await response.json()

Loading…
Cancel
Save