进阶
进阶教程可以让你更深入地了解 alova 的一些特性,它们可能并不是常用功能,但可以帮你快速解决更多特殊的请求问题。
📄️ Fetch Data
When you have the following needs:
📄️ Update states across components
There is a scenario where when the user clicks on an item in the todo list, enters the todo details page and edits it, at this time we hope that the todo list data on the previous page will also be updated without resetting the situation. For edited content, useFetcher is no longer applicable.
📄️ Method Matcher
A method matcher is a method that dynamically finds a method instance in a list of requested method snapshots. It is generally used. When developers are not sure which method to use, they can use the method matcher to search according to certain rules.
📄️ Middleware
Request middleware is an asynchronous function. it provides a powerful ability to control almost all behaviors of a request. If you just use alova, then you probably don't need to use request middleware, because it is mainly used to complete custom request strategies, no matter simple or complex request strategies, you may use it, let's look at it next What magical powers does it have.
📄️ custom method key
v2.20.0+
📄️ Error logger
v2.6.0+
📄️ cache logger
v2.8.0+
📄️ Manage extra states
In the previous Cross Page/Module Update Response States chapter, we introduced how to update the response status across pages or modules, but in this chapter we It only introduces updating the data state returned by useRequest and useWatcher through updateState, the value of data is always consistent with the response data, but in many cases we will use additional states(such as state A) to display data, and After the request is successful, the data data is appended to the additional state A, such as the pagination scheme of pull-down loading. In this case, we need to manage the additional state A so that it can be updated across pages/modules.
📄️ Server-Side Rendering(SSR)
2.8.0+