Add the attribute 'key' to div

Top level elements inside arrays should have the 'key' attribute set to allow React to efficiently rerender the elements of the array.
pull/81/head
Matvii Hodovaniuk 4 years ago committed by GitHub
parent d38ff15bd7
commit a81cb97810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,9 +29,9 @@ class App extends Component {
}) })
} }
renderCountries = () => { renderCountries = () => {
return this.state.data.map((country) => { return this.state.data.map((country, i) => {
return ( return (
<div> <div key={i}>
<div> <div>
{' '} {' '}
<img src={country.flag} alt={country.name} />{' '} <img src={country.flag} alt={country.name} />{' '}

Loading…
Cancel
Save