EDIT: mixed up when the log was showing up.
Right now "DONE" is logged before everything is fetched when I expect it to log afterwards. Thus I'm not able to properly use my isLoading state. I still need to setup error handling but I don't think that should matter for now. Any help would be greatly appreciated, thanks!
const [isLoading, setIsLoading] = useState(false)
useEffect(() => {
async function fetchGames() {
try {
setIsLoading(true)
console.log('FETCHING');
getPlayableGames().then((gameList) => setGameList(gameList))
setIsLoading(() => false)
} catch {
} finally {
setIsLoading(false)
console.log('DONE');
}
}
fetchGames()
}, [])