useEffect(() => { if (inputValue) { const query = `query($code: ID!) { continent(code: $code) { countries { name } } }`; fetchGraphQL(query, { code: inputValue }).then((data) => { setCountries(data.data.continent.countries); }); setIsVisible(true); const timer = setTimeout(() => { setIsVisible(false); }, 1000); return () => clearTimeout(timer); } }, [inputValue]);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter