mirror of
https://github.com/10h30/fullstackopen.git
synced 2026-07-17 05:23:24 +09:00
Completed 2.12
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import axios from 'axios'
|
||||
import Filter from './components/Filter'
|
||||
import Country from './components/Country'
|
||||
|
||||
const App = () => {
|
||||
|
||||
@@ -16,7 +17,6 @@ const App = () => {
|
||||
.get('https://restcountries.eu/rest/v2/all')
|
||||
.then(response => {
|
||||
setCountryList(response.data)
|
||||
console.log(CountryList)
|
||||
})
|
||||
}, [])
|
||||
|
||||
@@ -27,13 +27,7 @@ const App = () => {
|
||||
<div>
|
||||
<h2>Country</h2>
|
||||
<Filter value={newSearch} onChange={handleSearchChange} />
|
||||
|
||||
{
|
||||
filtered.length > 10 ?
|
||||
'Too many matches, specific another filter' :
|
||||
filtered.map(item => <p key={item.alpha2Code}>{item.name}</p>)
|
||||
}
|
||||
|
||||
<Country data={filtered} />
|
||||
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user