Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was looking at the svelte-query PRs recently, and I didn't see anything that looked like "trashing".

I agree that if you want to keep the patterns that make React-query so amazing, but apply them in Svelte, you should use idioms that make sense in Svelte. The exact syntax (`useQuery` and friends) isn't the point, and the `use[A-Z].*` naming convention actually communicates that you're hooking into the React lifecycle... which obviously doesn't make sense in Svelte.



This could have been a year ago at this stage. It was on r/svelte, if I recall correctly. Svelte doesn't have idioms for reusable reactive logic. The $ sign is used to drive functionality in Svelte, so you can't use it to signify something observable like with RXJS. For Solid, they use createQuery because that is the convention in Solid. For Vue and Svelte, they stick with useQuery. I think the idea is that useX is just a shorthand for "here is some abstracted reactive functionality". Ultimately it has nothing to do with how the reactivity works, it just says, "this function will tie into your reactivity". They could have just called it query, but it seems arbitrary to change the name.


You can absolutely make reusable reactive logic in Svelte, custom stores work great for this.

The problem with "useX" isn't an anti-react one, it's that "use" is an actual thing in Svelte, it's called an action! https://svelte.dev/docs#template-syntax-element-directives-u... :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: