You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data is loaded fine (1. log), but once I call useState or useEffect, the code after (2. log) is no longer executed.
Not sure what's going on. No exception thrown. Works fine with plain fetch.
Did I miss something?
importuseFetchfrom'react-fetch-hook';// 1.9.5constUserTable=()=>{const[users,setUsers]=useState([]);const{ isLoading, data, error }=useFetch('/admin/users');console.log('data',isLoading,data,error);if(isLoading||!data)return'Loading...';if(error)return'An error has occurred: '+error.message;// setUsers([]); // if called, the following code is dead// useEffect(() => { console.log('data changed') }, [data]); // same with thisconsole.log('data2',data);};
The text was updated successfully, but these errors were encountered:
data
is loaded fine (1. log), but once I calluseState
oruseEffect
, the code after (2. log) is no longer executed.Not sure what's going on. No exception thrown. Works fine with plain
fetch
.Did I miss something?
The text was updated successfully, but these errors were encountered: