Skip to main content

A lightweight request strategy library

Choose the request strategy you want, the declarative implementation of complex network requests with minimal code can greatly enhance the fluidity and availability of your application, making it appear as if it has exceptional strategic thinking, much like a wise man.

$ npm install alova
const todo = alova.Get('/todo', {
params: {
id: 1
}
});
const { loading, data, error } = useRequest(todo);

High performance request strategy

10+ request strategy modules that can be used directly, just choose the one you want to use, and it can also reduce performance problems caused by requests.

Simple and familiar

API design similar to axios, making it easier and more familiar for you to get started

Request-level cache

Provides various server-side data cache modes such as memory mode and persistence mode to improve user experience and reduce server pressure

Lightweight

compressed version is only 4kb+, only 30% of axios

Breaking the boundary of the usage of useHook

🎉NOW alova is perfectly compatible with vue options, enjoy it!

Relationship between alova and request library

Traditional promised request library solves the problem of request sending very well, but They are simply request sending tools

Just like their weapon arsenal, alova grants them enhanced capabilities. Whether you prefer using axios, superagent, or the browser's fetch API, alova seamlessly integrates with all of them.

Accomplish your requests in a declarative manner

Just choose the request strategy you want to use, saving your amount of time, and make your application more fluency

  • Basic request
  • Request when states changed
  • Prefetch data
  • Pagination request
  • Token authentication
  • Sensorless data interaction strategy
  • Form Submit strategy
  • Auto refetch data
  • File upload strategy
  • Send captcha
  • Cross-component request strategy
  • Request retry strategy
  • SSE

Basic request

Send request with useRequest, it will automatically maintain the states related to this request.

Similar to axios.
Maintains the states automatically.
Response cache.
Share the same request sent at the same time.
More details
const todoDetail = alova.Get('/todo', {
params: {
id: 1
}
});
const {
loading, data, error,
onSuccess, onError, onComplete,
send, abort, update
} = useRequest(todoDetail);
More details

Runs in any JS environment with any request tool

Use hooks originated from functional components, but alova innovatively made it compatible with options and class-style UI frameworks, which means that alova's use hooks are almost not restricted by JS environments and UI frameworks, and can be used together with your familiar request tools.