This is about to test your ability to work with react-hooks and its components.
Live preview of the app is here: https://cat-facts-excercise.netlify.app/#/catfacts
$ git clone https://github.com/Pe5h4/excercise-catfacts.git
$ cd excercise-catfacts
$ yarn install
$ yarn start
All the components you are going to / you can use are already imported.
- Fetch Cat fact from
https://catfact.ninja/fact
on page initialization and render it toCardHeader
Example of the response:
{ data: { fact: 'Some fact', length: 9}, status: 200, statusText: "OK", headers: {…}, config: {…}, request: XMLHttpRequest }
We are interested in data.fact
response.
- Fetch Cat breeds from
https://catfact.ninja/breeds
onGet breeds
button click and render the data toTable
.
Example of the response:
{ data: {
...
data: [{breed: 'Some', coat: 'Some', country: 'Distant', origin: 'Natural', pattern: 'None'}, {…}, ...],
...
}, status: 200, statusText: "OK", headers: {…}, config: {…}, request: XMLHttpRequest }
We are interested in data.data
response.
- Get another fact with
Get fact
button.
- Remove the breeds from the table by clicking on
Remove breeds
button.