Exploring innovation, digital culture, and the future of tech 🌐
Here to connect, learn, and share insights ✨
https://www.linkedin.com/in/thiago-lino-gomes-5812581bb
https://github.com/thiagolino8
Before useEffectEvent, useRef + useEffect was the only way to use functions with unstable references in another useEffect
Optimistic state, asynchronous state, and so on
Before useEffectEvent, useRef + useEffect was the only way to use functions with unstable references in another useEffect
Optimistic state, asynchronous state, and so on
Before useSyncExternalStore, it was the only way to sync with external state
Before useSyncExternalStore, it was the only way to sync with external state
In any framework, changing state within an effect is suboptimal
In React, even when it doesn't create an infinite loop, it's still a ticking time bomb waiting to explode your app's performance by creating additional rendering cycles.
In any framework, changing state within an effect is suboptimal
In React, even when it doesn't create an infinite loop, it's still a ticking time bomb waiting to explode your app's performance by creating additional rendering cycles.
Operators like `import()` or `super()`, which look like functions, are, as far as TS is concerned, just functions but they have their own specific usage rules
This is what MDN calls a function-like expression
Operators like `import()` or `super()`, which look like functions, are, as far as TS is concerned, just functions but they have their own specific usage rules
This is what MDN calls a function-like expression
v4.svelte.dev/docs/svelte-...
v4.svelte.dev/docs/svelte-...
svelte.dev/docs/kit/rem...
svelte.dev/docs/kit/rem...
But even in this case, useDeferredValue can be used to avoid displaying the fallback
But even in this case, useDeferredValue can be used to avoid displaying the fallback
So in total, there are at least 100 different uses of useSuspenseQuery
It's an app with a lot of data updates and derivations
Nowhere is there any fallback after the initial load
So in total, there are at least 100 different uses of useSuspenseQuery
It's an app with a lot of data updates and derivations
Nowhere is there any fallback after the initial load
React-query had very little to do with the problem
So much so that it was necessary to use both to reproduce the issue.
bsky.app/profile/rick...
React-query had very little to do with the problem
So much so that it was necessary to use both to reproduce the issue.
bsky.app/profile/rick...
Using useDeferredValue in the query parameters has been working for me, no fallbacks after the initial load.
Using useDeferredValue in the query parameters has been working for me, no fallbacks after the initial load.
Additionally, it is possible to take the promise from the query and use "use" directly
Additionally, it is possible to take the promise from the query and use "use" directly
function getLinkProps(href) {
return {
href,
class: {
active: page.url.pathname === href
}
}
}
<a {...getLinkProps('/some/path')} />
But in the end it's just a matter of preference
function getLinkProps(href) {
return {
href,
class: {
active: page.url.pathname === href
}
}
}
<a {...getLinkProps('/some/path')} />
But in the end it's just a matter of preference
Personally I prefer using the new built-in clsx in the class prop instead of toggling class imperatively, to remove the need for :global
Personally I prefer using the new built-in clsx in the class prop instead of toggling class imperatively, to remove the need for :global
Bonus: no flickering on mount
Bonus: no flickering on mount
In any other framework this is suboptimal, in react this is a minefield:
let count = $state(0)
let double = $state(count * 2)
$effect(() => {
double = count * 2
})
svelte.dev/playground/h...
In any other framework this is suboptimal, in react this is a minefield:
let count = $state(0)
let double = $state(count * 2)
$effect(() => {
double = count * 2
})
svelte.dev/playground/h...
No wonder all frameworks that came after React hooks copied useEffect api and still don't have 90% of the problems that "useEffect has"
No wonder all frameworks that came after React hooks copied useEffect api and still don't have 90% of the problems that "useEffect has"
UseEffect is actually a good API
The problem (specifically in React) is the re-rendering model
What caused the problem in Cloudflare's case, for example, was that changing state within the effect causes the component to be re-executed, and consequently, your component to be recreated
UseEffect is actually a good API
The problem (specifically in React) is the re-rendering model
What caused the problem in Cloudflare's case, for example, was that changing state within the effect causes the component to be re-executed, and consequently, your component to be recreated
svelte.dev/playground/h...
svelte.dev/playground/h...
Also, infinite queries are simpler to handle when it's necessary to invalidate a list
Also, infinite queries are simpler to handle when it's necessary to invalidate a list