We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
No description provided.
The text was updated successfully, but these errors were encountered:
const useRequest = (request,options = {}){ const {debounceWait = 0,throttleWait = 0} = options const [loading,setLoading] = useState(false) const [error,setError] = useState(null) const [data,setData] = useState(null) const run = useCallback((params)=>{ setLoading(true) const doRequest = ()=>{ request(params).then(res=>setData(res)).catch(e=>setError(e)) .finally(setLoading(false)) } if(debounceWait > 0){ debounce(doRequest,debounceWait) }else if(throttleWait > 0){ throttle(doRequest,throttleWait) }else{ doRequset() } } ,[request,debounceWait,throttleWait]) return {loading,run,error,data} }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: