Skip to main content
Version: v2

Overview

Alova has high scalability. In addition to providing common features such as core caching mechanism, request sharing mechanism, and state management, it also provides various customization functions and middleware mechanisms, which can adapt to different js environments and customize requests. Strategy.

Adapter

In order to meet the running requirements of js in different environments, you can customize the request adapter, storage adapter, and even the state adapter of the UI framework, which will be introduced in detail in the next chapters. Some adapter examples are listed below.

You can also combine multiple types of adapters into a collection, for example Uniapp Adapter.

Write request strategy

alova's request strategy is separate from the alova core library, so that developers can also take advantage of alova's high scalability to write their own request strategies. Usually, a custom request strategy is based on the combination of useRequest, useWatcher and useFetcher, and writing middleware, cache manipulation functions for them to control their The request method, so as to realize the request strategy of various effects.

The request strategies in @alova/scene are well represented, and it is strongly recommended that you refer to the source code for inspiration.