From 2afb6a7764086cc33d62510a2d663bce6ba00608 Mon Sep 17 00:00:00 2001 From: No0ne003 Date: Wed, 1 May 2024 14:25:30 +0100 Subject: [PATCH] github profile finder better loading --- .../GithubProfileFinder.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/pages/GithubProfileFinder/GithubProfileFinder.jsx b/src/pages/GithubProfileFinder/GithubProfileFinder.jsx index e686d8d..ec934b9 100644 --- a/src/pages/GithubProfileFinder/GithubProfileFinder.jsx +++ b/src/pages/GithubProfileFinder/GithubProfileFinder.jsx @@ -13,10 +13,13 @@ export const GithubProfileFinder = () => { const res = await fetch(`https://api.github.com/users/${userName}`); const data = await res.json(); + if (data) { setUserData(data); setLoading(false); } + + console.log(data) } function handleSumbit() { @@ -27,14 +30,6 @@ export const GithubProfileFinder = () => { fetchGithubUserData(); }, []); - if (loading) { - return ( -
-
-
- ); - } - return (
@@ -49,7 +44,13 @@ export const GithubProfileFinder = () => { Search
- {userData !== null ? : null} + {loading ? ( +
+
+
+ ) : userData !== null ? ( + + ) : null}
); };