Last active
February 10, 2021 19:25
-
-
Save moonformeli/ec6d90aee69798ee6c96872600718dcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyPage() { | |
const [myInfo, setMyInfo] = useState(null); | |
const [billHistory, setBillHistory] = useState([]); | |
const [friendsList, setFriendsList] = useState([]); | |
useEffect(() => { | |
fetchMyInfo().then(async (mInfo) => { | |
setMyInfo(mInfo); | |
const bHistory = await fetchBillHistory(); | |
const fList = await fetchFriendsList(); | |
setBillHistory(bHistory); | |
setFriendsList(fList); | |
}) | |
}, []); | |
return ( | |
<div> | |
{myInfo && <MyInfo myInfo={myInfo} />} | |
{billHistory.length > 0 && <BillHistory billHistory={billHistory} />} | |
{friendsList.length > 0 && <FriendsList friendsList={friendsList} />} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment