3 ms·
This looks very smart, it’s like a SolidJS that is web-component native first and foremost. I like this framework substantially more than the previous web compo
by jitl 2y ago
This looks very smart, it’s like a SolidJS that is web-component native first and foremost. I like this framework substantially more than the previous web component systems I’ve seen that feel much more like “library” and it’s a bit choose your own adventure. I am a fan of React/Solid so I appreciate that Brisa has a lot of nice React things like tree of function components and taking care attribute vs property difference. I’m not sure how I feel about the signal implementation, it’s really unclear to me how this magic works and after reading a few pages of the docs I’ve encountered many times “doing X may break reactivity, so do Y instead”. I maintain Notion’s reactivity framework so I’m not new to this overall, but the use of Proxy magicks is always hard to understand. Perhaps with use it will become second nature and I certainly like avoiding dependency arrays but I’m left uneasy.
- aralroca 2y agoWe 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