3 ms·
Because the backend actually does something. Truth is 99% of frontends are just a way to display data just fetched from the server and don't really have a need
by doodlesdev 4y ago
Because the backend actually does something. Truth is 99% of frontends are just a way to display data just fetched from the server and don't really have a need for state management at all. For the 1% out there, use Redux (or Redux Toolkit), or maybe forget about React since it's not the only library ever invented.
- jrvarela56 4y agoHow would you develop a web app that needs to work offline?
- doodlesdev 4y agoYou could very easily handle storing to localstorage or indexeddb using stores. However, in larger projects that can become error prone and increase complexity (unnecessarily). To simplify this workflow you could use something like https://github.com/andsala/svelte-persistent-store https://github.com/andsala/svelte-persistent-store Note that repo is basically 50 lines of code to automate this stuff, which is pretty remarkable. However this still won't handle cache invalidation or syncing. https://sveltequery.vercel.app/ https://sveltequery.vercel.app/ should handle most use cases. This is very similar to React Query (since it's from the same devs at https://tanstack.com/ https://tanstack.com/). For handling the service workers stuff for (what I assume would be a PWA) I'd just use the Vite PWA plugin which uses workbox. That's if I need a service worker at all, if I don't I'd just set the manifest and be done with it. An alternative depending on the needs of the specific project is to just fallback on something like the Firebase or Supabase SDK which handle offline mutations and syncing for you, for simpler projects these work incredibly well.
- qudat 4y ago> Because the backend actually does something. Yikes. We can be just as reductionist about the BE: it’s just a shim for accessing a database.
- doodlesdev 4y agoFor most CRUD apps it is, that's why we can have things such as Firebase which is essentially just a layer between the frontend and database, with some security rules and you're done. Most developers overengineer to the extreme their projects. I'm not saying all of them are like this, or that all applications are just simple CRUDs, but most are.