94 Matching Annotations
- Aug 2026
-
-
-
jsmanifest.com jsmanifest.com
-
Preact Signals provide a minimal signal implementation that works with Preact or React:
-
const count = signal(0); const doubled = computed(() => count.value * 2);
I like this syntax better than Solid's. It returns a single object (with .value) rather than explicit getter/setter.
I wonder if there's a way to use similar syntax in Solid? Don't see any reason why we couldn't easily wrap createSignal with a nicer API.
-
Signals break component boundaries. A signal defined in one component can be read by any other component that imports it. This enables powerful patterns but violates React's principle that data flows down through props and up through callbacks.
-
The convergence on signals across frameworks proves the pattern's universality. Each framework adapted signals to its existing architecture while preserving the core mental model.
-
-
www.sabaoon.dev www.sabaoon.dev
-
Signals libraries for React: @preact/signals-react and jotai provide signal-like primitives that work within React's model. These are viable for performance-critical components.
-
The convergence of major frameworks on signals-based reactivity is not fashion—it is a recognition that the virtual DOM model, while powerful, has a fundamental inefficiency: it describes what to render rather than what changed. Signals describe exactly what changed and update exactly what depends on it.
-
Signals invert this. Instead of "re-run everything and figure out what changed," signals say "run only what is directly subscribed to the specific value that changed." The computational difference is significant in applications with large component trees and frequent state updates.
-
-
preactjs.com preactjs.com
Tags
Annotators
URL
-
-
tanstack.com tanstack.com
-
Signal-native adapters implement it with their framework primitives and can keep option reads in the same reactive graph.
-
The core reactivity depends on a small shared atom contract provided by @tanstack/store:Signal-native adapters implement it with their framework primitives and can keep option reads in the same reactive graph.Store-backed adapters keep options synchronized during render; in React, granular rendering is opt-in through selectors and Subscribe.
-
The primary purpose of a headless library like TanStack Table is to provide the correct state management core, but we needed to rethink how much of the core library worked under the hood and connected to each framework's reactive model.
-
-
tanstack.com tanstack.com
-
Every framework adapter's reactivity system was completely overhauled in Table V9. With table state now built on TanStack Store, each adapter can connect the framework-agnostic core to its framework's native reactive model instead of working around assumptions inherited from React. This is especially significant for signal-based frameworks because table atoms now connect much more directly to signals, refs, runes, and tracked values, making those adapters more performant overall and bringing them much closer to true signal-based rendering. TanStack Table V9 now ships ten dedicated framework adapters, plus the framework-agnostic @tanstack/table-core.
-
- Jun 2025
-
svelte.dev svelte.dev
-
When writing component tests that involve two-way bindings, context or snippet props, it’s best to create a wrapper component for your specific test and interact with that. @testing-library/svelte contains some examples.
-
-
github.com github.com
-
However, to do that, you have to put the $state value in a callback (or getter/setter object) in the parameters of the function. This feels rather clunky and un-Svelte like. Here's an example of what I mean.
This works. See their demo.
-
-
-
github.com github.com
-
let myObj = { ...$get({foo, bar}) }
This was offered as a solution to https://github.com/sveltejs/svelte/issues/14404
-
- Jan 2022
-
translational-medicine.biomedcentral.com translational-medicine.biomedcentral.com
-
Liu, Y., Ebinger, J. E., Mostafa, R., Budde, P., Gajewski, J., Walker, B., Joung, S., Wu, M., Bräutigam, M., Hesping, F., Rupieper, E., Schubert, A.-S., Zucht, H.-D., Braun, J., Melmed, G. Y., Sobhani, K., Arditi, M., Van Eyk, J. E., Cheng, S., & Fert-Bober, J. (2021). Paradoxical sex-specific patterns of autoantibody response to SARS-CoV-2 infection. Journal of Translational Medicine, 19(1), 524. https://doi.org/10.1186/s12967-021-03184-8
-
-
svelte.dev svelte.dev
-
github.com github.com
-
stackoverflow.com stackoverflow.com
-
Explicitly defining the dependency in the reactive declarations
-
inputValue = updateInputValue(value);
-
-
github.com github.com
-
github.com github.com
-
github.com github.com
-
We should instead invalidate the ultimate dependencies of filtered rather than filtered itself:
-
-
-
github.com github.com
-
Svelte currently consistently gives the reactive statement priority over your checked binding.
-
-
github.com github.com
-
github.com github.com
-
maybe this just comes down to general footguns with reactivity, and being aware of them as a developer.
-
- Nov 2021
-
stackoverflow.com stackoverflow.com
-
Stores are the idiomatic Svelte way when you need to import "reactivity" from your normal JS sources.
-
-
stackoverflow.com stackoverflow.com
-
if you put the reactive statement $: validate(inputValue); after the function updateInputValue declaration, it's working as expected:
-
- Oct 2021
-
www.kylehq.com www.kylehq.com
-
And on any given day, developing with Svelte and its reactive nature is simply a dream to use. You can tell Svelte to track state changes on practically anything using the $: directive. And it’s quite likely that your first reactive changes will produce all the expected UI results. But as you start to rely more on UI updates based on variable or array/object changes, it’s likely that your UI will start skipping a beat and dropping values that you know explicitly to be there.
-
-
stackoverflow.com stackoverflow.com
-
Personally I think option 1 is the way to go as it doesn't allocate any memory to create a new array but rather modifies the existing array. Then the assignment just lets the compiler know that you modified the array.
-
- Sep 2021
-
psyarxiv.com psyarxiv.com
-
DuPont, C. M., Pressman, S., Reed, R. G., Marsland, A., Manuck, S. N., & Gianaros, P. J. (2021). An Online Trier Social Stress Paradigm to Evoke Affective and Cardiovascular Responses [Preprint]. PsyArXiv. https://doi.org/10.31234/osf.io/fcyqd
-
- Feb 2021
-
psyarxiv.com psyarxiv.com
-
Safra, L., Chevallier, C., & Sijilmassi, A. (2021). Poverty and Threat Reactivity. PsyArXiv. https://doi.org/10.31234/osf.io/fp35r
-
- Jan 2021
-
github.com github.com
-
Or just watch the value with a reactive statement instead of an event handler on the input like: $: inputValue, onInput() This is a good solution and seems to work in all cases.
-
-
github.com github.com
-
What I think is happening is that instantiating the component is immediately running the $: reactive code, which dispatches the event synchronously, before the parent component attaches the listener.
-
-
- Nov 2020
-
codeburst.io codeburst.io
-
A great thing about CSS variables is their reactive nature. As soon as we update them, whatever property has the value of the CSS variable gets updated as well.
-
-
timdeschryver.dev timdeschryver.dev
-
For me, this makes Svelte the most reactive "framework" at the moment
-
- Oct 2020
-
svelte.dev svelte.dev
-
svelte.dev svelte.dev
-
svelte.dev svelte.dev
-
My version of https://svelte.dev/repl/9c7d12357a15457bb914705702f156d1?version=3.19.2 from https://github.com/sveltejs/svelte/issues/4586
to try to simplify and help me understand it better.
So the lack of synchronousness is only noticed inside handleClick.
By the time the DOM gets updated, it has a consistent/correct state.
In other words, the console.log shows wrong value, but template shows correct value. So this might not be an actual problem for many/most use cases.
-
-
svelte.dev svelte.dev
-
github.com github.com
-
github.com github.com
-
I too have been confused by behavior like this. Perhaps a clearly defined way to isolate atomic units with synchronous reactivity would help those of us still working through the idiosyncrasies of reactivity.
-
-
For performance reasons, $: reactive blocks are batched up and run in the next microtask. This is the expected behavior. This is one of the things that we should talk about when we figure out how and where we want to have a section in the docs that goes into more details about reactivity. If you want something that updates synchronously and depends on another value, you can use a derived store:
-
-
github.com github.com
-
-
even though f() reads the reactive variable count in its body, because the variable count isn't present in the reactive statement itself, the statement is not seen as having a dependency on count.
-
-
github.com github.com
-
I expected that the param being passed by reference to have the same reactivity of the variable being created in the script tag.
-
-
-
There's an issue #3368 for describing better what triggers reactive updates, as I do think there is some stuff we could be more explicit about
-
-
vuejs.org vuejs.org
-
These are good docs.
Referenced by: https://github.com/sveltejs/svelte/issues/3368#issuecomment-519289238
-
-
github.com github.com
-
This isn't a bug. Svelte's reactivity is triggered by assignment, so it won't re-render on mutations like array pushing.
-
this is a common Svelte idiom for manually invalidating something that might have been mutated without there being a visible = sign somewhere
-
-
www.hackingwithswift.com www.hackingwithswift.com
-
Imperative UI causes all sorts of problems, most of which revolve around state, which is another fancy term meaning “values we store in our code”. We need to track what state our code is in, and make sure our user interface correctly reflects that state.
-
-
svelte.dev svelte.dev
-
whenValueChanges whenValueBecomes
-
-
github.com github.com
-
Store is reactive because it should re-evaluate when track is changed.
-
-
levelup.gitconnected.com levelup.gitconnected.com
-
Since Solid uses fine grained updates and Components are only rendered in their entirety once, you can wrap over state simply by using closures.
-
-
-
It is built using brutally efficient fine-grained reactivity(No Virtual DOM)
-
-
-
I kept on wanting them to work like Fine-Grained reactivity, since it was much more intuitive.
-
-
-
The $: can also be used to trigger effects.
-
Any variable referenced on the lines marked with $: is marked as a dependency of the derived variable.
-
We can run effects when some data changes using watchEffect - it takes a function that runs whenever a reactive value used inside changes.
-
There's one downside to Reacts reactivity model - the hooks (useState and useEffect) have to always be called in the same order and you can't put them inside an if block.
-
It's possible to run a function whenever some reactive state changes using the useEffect hook. In the example we log the length of the todoList whenever it changes. The first argument to useEffect is the function we want to run, and the second is a list of reactive values to track - whenever one of these values changes the effect will run again.
-
So how do we declare the variable y to be the value of x plus 5? That's where reactive programming comes in. Reactive programming is a way of programming that makes it possible solve this problem
Tags
- reactive programming
- reactivity
- react hooks
- good explanation
- confusing for newcomers
- equivalent/analogous/alternative ways to do something between 2 libraries/languages/etc.
- order is important / do things in the right order
- Vue
- Svelte: reactivity
- React
- useEffect
- simple explanation
Annotators
URL
-
-
-
Do these blocks allow for reactive assignments? @lukeed They're read-only, but values update when their dependencies do
Tags
Annotators
URL
-
-
-
$: for watching dependencies in expressions, a much more concise useEffect, if React is familiar.
-
- Sep 2020
-
www.javascriptjanuary.com www.javascriptjanuary.com
-
As you can see, it uses Javascript label syntax to tell the compiler where recalculation should be carefully managed. And you thought that no one uses labels any more.
-
You know those useMemo and useCallback hooks? Well, Svelte has something like this. If you declare a variable like this: $: double = counter * 2;, Svelte will recalculate it only if counter changes.
-
-
svelte.dev svelte.dev
-
for example, reactive declarations essentially do the work of React's useMemo, useCallback and useEffect without the boilerplate (or indeed the garbage collection overhead of creating inline functions and arrays on each state change).
-
-
github.com github.com
-
Since one of Svelte's main principles is reacting only to data changes (as opposed to re-render the whole app with the full state all the time)
-
-
github.com github.com
-
Using a reactive statement is a good way to explicitly turn a reactive variable into a store
-
Non-store reactivity needs to be analyzable at compile time.
-
-
daveceddia.com daveceddia.com
-
Svelte only runs the <script> code once.
-
-
blog.carbonfive.com blog.carbonfive.com
-
$: declares a relationship, where remaining should always be 10 - count. This might seem weird, but it’s conceptually the same as declaring a variable that you know will be re-calculated in every React render loop — except that remaining will get recalculated only when count changes.
-
Since you often want to do calculations based on state, Svelte also has the “reactive declaration” symbol, $:. It’s like a let declaration, but whenever any variable referenced in the expression — count in this case — is updated, the expression is re-run, the new variable’s value is updated, and the component is re-rendered.
-
The heart of Svelte’s magic is “reactivity”. Every let declaration sets up a listener, where any time the variable is assigned to, the change triggers a render of the component. So when the increment function calls count++, the component will re-render, which will update the value shown to the user by Count: {count}.
-
-
svelte.dev svelte.dev
-
Reactive statements run immediately before the component updates, whenever the values that they depend on have changed.
Tags
Annotators
URL
-
-
svelte.dev svelte.dev
-
You're not limited to using $count inside the markup, either — you can use it anywhere in the <script> as well, such as in event handlers or reactive declarations.
Don't forget to make the statement reactive. Referencing $count is not enough to get it to be re-run on update!!
Example:
$: console.log(`the count is ${$count}`);
-
- Aug 2020
-
science.sciencemag.org science.sciencemag.org
-
Mateus, J., Grifoni, A., Tarke, A., Sidney, J., Ramirez, S. I., Dan, J. M., Burger, Z. C., Rawlings, S. A., Smith, D. M., Phillips, E., Mallal, S., Lammers, M., Rubiro, P., Quiambao, L., Sutherland, A., Yu, E. D., Antunes, R. da S., Greenbaum, J., Frazier, A., … Weiskopf, D. (2020). Selective and cross-reactive SARS-CoV-2 T cell epitopes in unexposed humans. Science. https://doi.org/10.1126/science.abd3871
-