Noob question: Axios vs Fetch
I did not see anything in the docs explaining fetch.
Does fetch have some built in "magic" that makes it preferable to use over Axios or another request package?
6 Replies
fetch is usually available already, so it doesn't increase the bundle size.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
If you only need cancellation, you can use https://primitives.solidjs.community/package/resource#makeabortable
Solid Primitives
A library of high-quality primitives that extend SolidJS reactivity
Also, for more complex requirements, you could also consider using TanStack: https://tanstack.com/query/v4/docs/react/adapters/solid-query
Solid Query | TanStack Query Docs
The @tanstack/solid-query package provides a 1st-class API for using TanStack Query with SolidJS.
Example
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It fulfills the same needs with a slightly higher level of sophistication, I suppose. It also does more than that.
I guess it depends what you need. In Solid, we usually appreciate that one size doesn't fit all, so we're happy to have solutions on different levels of complexity and sophistication.
There are different projects catering to different needs: solid-primitives delivers the building blocks beyond solid's own primitives to connect into your own simple solution. Solid-start as a meta framework brings the patterns and binding glue for isomorphic applications. TanStack has a framework-agnostic integrated state-management solution.
Solid-primitives are usually really small and tree-shakable, so if a low bundle size is your goal, those are your best bet. They also usually work well with all other solutions.
Solid-start is your best choice for fully isomorphic solid apps.
TanStack is tried and tested, fully integrated with all bells and whistles; it's obviously large in comparison, but has a pretty sweet DX.