Skip to content

Implement prevent call fetch

Choose a tag to compare

@ilyalesik ilyalesik released this 14 Mar 15:52
· 170 commits to master since this release

Implement prevent call fetch

For prevent call fetch you can pass preventCallFetch prop:

const {authToken} = useContext(authTokenContext);
const { isLoading, data } = useFetch("https://swapi.co/api/people/1", {
    preventCallFetch: !authToken //don't call request, if haven't authToken
});