Next.js Discord

Discord Forum

How to implement `next tag` using axios?

Unanswered
Scaly-naped Pigeon posted this in #help-forum
Open in Discord
Scaly-naped PigeonOP
I want to use axios.
how to convert below code using axios?

  const res = await fetch('https://...', { next: { tags: ['collection'] } })
  const data = await res.json()

10 Replies

Asian paper wasp
For the stable option, there isn't.
For the unstable option, there's unstable_cache. You may take a look at the doc.
Scaly-naped PigeonOP
thank you for answer!
Northeast Congo Lion
is there a reason u need to use axios over fetch?
i used to swear by axios, but after checking my use-cases fetch was more than enough, helps importing additional packages too 😛
my project uses axios, fetch, And react-query
I want to remove one of 'axios' and 'fetch'.
The combination of ‘react-query’ and ‘axios’ is good.
So I decided to remove fetch.
I have one more question.
Is the combination of react-query and fetch fine?
(I'm sorry that my English isn't very good.)
@Scaly-naped Pigeon I have one more question. Is the combination of react-query and fetch fine?
Asian paper wasp
Yes.
The main reason people kind of discourages Axios is that they feel fetch, a native API can do most of what Axios can do. However, Axios does offer some features that make it easier to organize fetchers. So depending whether you are using those features or not
Scaly-naped PigeonOP
i will have to remove axios!
Thankyou for answer!