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? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello! I need make only one get request with other headers. How can I set Headers in the GET request?
I want make something like this: `
const HOCComponent = () => { const {get, data} = useFetch('/api'); const [hasFirstRequest, setHasFirstRequest] = useState(false); useEffect(() => { get('/users', { headers: { Prefer: 'count=estimated', } }).then(() => setHasFirstRequest(true)); }, [get]) useEffect(() => { if (hasFirstRequest) { get('/users') } }, [hasFirstRequest]);
}
`
The text was updated successfully, but these errors were encountered:
Any update on this? I want to do the same thing but it doesn't seem to be possible :(
Sorry, something went wrong.
@mdenburger Hi! I found this solution: const { get: getGeneral, loading: loadingGeneral } = useFetch(${endpoint}${params.total}, { const { get: getFirst, loading: loadingFirst } = useFetch(${endpoint}${params.total}, { headers: { Prefer: 'count=estimated', }, });
${endpoint}${params.total}
I used two useFetch. getFirst is with changed headers and I use getFirst only when I need it
No branches or pull requests
Hello!
I need make only one get request with other headers. How can I set Headers in the GET request?
I want make something like this:
`
}
`
The text was updated successfully, but these errors were encountered: