๐—ง๐—ต๐—ฒ ๐—˜๐˜ƒ๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป ๐—ข๐—ณ ๐——๐—ฎ๐˜๐—ฎ ๐—™๐—ฒ๐˜๐—ฐ๐—ต๐—ถ๐—ป๐—ด

Frontend fetching changed. It started with callbacks. Then it moved to Promises. Now we use strategy-based hooks.

Promise-based code is imperative. You tell the computer how to do every step. You manage loading states. You handle errors manually. You struggle with useEffect and useCallback. This creates too much boilerplate.

Strategy hooks are declarative. You describe what you need. The library handles the execution.

Libraries like alova offer specific hooks for business patterns:

This approach offers three main benefits:

Use strategy hooks if:

Stick to plain fetch or axios if:

Declarative fetching saves time. It removes repetitive code. Pick the tool based on your project scale.

Source: https://dev.to/coderhu/the-evolution-of-fetch-libraries-from-promise-to-strategies-2ckh