What are specialOptions for?
syabro opened this issue · 2 comments
syabro commented
It's only mentioned in https://github.com/ilyalesik/react-fetch-hook#usefetch
and it's duplicating regular options
ilyalesik commented
It's just for convenience. As an example, we can have function that returns params for fetch
function:
export const getSomeData = (options) => {
const { token } = options;
return [
url,
{
headers: {
Authorization: `JWT ${token}`
}
}
];
};
and destructure result of this function to useFetch
arguments:
const result = useFetch(
...getSomeData({
token
}),
{
depends: [something]
}
)
syabro commented
ty