Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 1.4 KB

README.md

File metadata and controls

31 lines (25 loc) · 1.4 KB

Table of Contents

Dev Notes

  • CSS reset - version 1.7.2 by @elad2412 used
  • Styling done mostly inline (javascript)
  • Q&A incorporated to CRA page using level1qna.js
  • Added a custom function hasCode.js to personal library
  • Utilized hooks on functional components:
    useState and useEffect for fetching flags .svg

Encountered Error

  • Error:
    • 404 on flags URL in data provided
  • Solution:
    • Used https://restcountries.com to fetch flags .svg and used a default image if flag cannot be found due to country name difference (data name and fetch url path)
    const url = `https://restcountries.com/v3.1/name/${name.toLowerCase()}`
    
    fetchFlag(url).catch(() => console.log(`Error fetching from ${url}`))
    • Done by using fetch API accompanied with { useState, useEffect } from 'react'