-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
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
[useFetch] Component is already mounted, please use $fetch instead. See https://nuxt.com/docs/getting-started/data-fetching #27242
Comments
Would you be able to provide a reproduction? 🙏 More infoWhy do I need to provide a reproduction?Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. What will happen?If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect. If How can I create a reproduction?We have a couple of templates for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as minimal as possible. See more details in our guide. You might also find these other articles interesting and/or helpful: |
Hello, that's because you're probably calling it outside a nuxt setup or component setup hook. see https://www.youtube.com/watch?v=njsGVmcWviY |
Can't I call it with a method? My English is not good and I can't understand the video. Can you describe it in text? Can't I call useFetch as a method? |
useFetch is a composable, it means that it is meant to be called in a setup function (nuxt or vue). |
Isn't there a universal method? |
Requests initiated only on the client side should use $fetch You can continue to use it, it will only display warnings, but problems may occur in some scenarios. |
Do I need to use two different methods for the server and client? |
I am not good at English and cannot translate videos. |
Yes, use 是的,如果这个调用只在客户端请求就使用 此外youtube有翻译字幕功能 |
I am currently only using useFetch, not refresh, and there are no errors. Will there be any unexpected issues? |
Not sure, it depends on the usage scenario |
你还可以这样:
|
Although it can be used, there are warnings. Why? Can't I keep using useFetch?
The text was updated successfully, but these errors were encountered: