4 ms·
We are not using a Proxy, the implementation of the signals is as follows: https://github.com/brisa-build/brisa/blob/main/packages/brisa/src/utils/signals/index
by aralroca 2y ago
We are not using a Proxy, the implementation of the signals is as follows: https://github.com/brisa-build/brisa/blob/main/packages/brisa/src/utils/signals/index.ts https://github.com/brisa-build/brisa/blob/main/packages/bris...
By rule, reactivity is broken if you declare a variable using the getter (.value) outside the JSX. This is because the component is called once, and during the rendering of the DOM elements, effect wrappers are added to register the getters (.value) of any signals.
However, to make life easier for developers, we make some optimizations in build time, to:
1. Support early returns.
2. Not having to use .value in the props (well, “WC attributes”) and being able to define default values, do destructuring, etc. without losing reactivity.
Apart from these exceptions, it is as I said at the beginning.
- jitl 2y agoHow does the props part work? That is the part I find confusing