Comments (4)
If this was easy to do, it would have been the default. The problem with it is that it doesn't work with reactivity where "reading is subscribing". This relies on getters. You can't implement the subscribe part if you destructure, as the component function body never reruns.
There is a community driven props destructuring plugin that rewrites your code, but I don't know how good that works. I feel like less compiler magic is better, but you have options for sure.
from solid.
If this was easy to do, it would have been the default. The problem with it is that it doesn't work with reactivity where "reading is subscribing". This relies on getters. You can't implement the subscribe part if you destructure, as the component function body never reruns.
There is a community driven props destructuring plugin that rewrites your code, but I don't know how good that works. I feel like less compiler magic is better, but you have options for sure.
Yes, i know that reactivity is lost when destructuring, but with the help of a compiler i don't think this would be an issue, i think this is the plugin which already does it, and to me this doesn't feel like compiler magic, more like, smoothening sharp edges of solidjs to make it look more like regular js
from solid.
Imo its magic because it (seems to) only work when having annotations on your functions which make them components. It is already pretty hard to get people who are used to react to understand reactivity. Now if you say, sometimes destructuring works, but only if you have this special annotation, that will be even more confusing. Personally, I would support this being core only if you can globally sove for this.
P.S. this would be better as a discussion than an issue. As it has been brought up many times.
from solid.
I agree. If anything this is better as a discussion. As @deluksic unless there was some unavoidable and automatic way to identify components this would never work. And more over it would take more than just handling function signatures if you wanted any sort of consistency. The complexity there is hard to merit.
Not that we are at that state now anyway. If we were to try to implement this it would make sense only to people already well aware of the problem, making the solution not any better than the problem as it interfere with teaching. Like why does certain things work and not others. It again requires too much specific knowledge.
from solid.
Related Issues (20)
- Cannot use istanbul ignore comments for generated code HOT 2
- setting element reference in `setStore` modifies the values in the array HOT 13
- `this` inside jsx-template inside a constructor of a derived class causes transformation-bug HOT 2
- The update of props is not granular enough. HOT 4
- No value attribute on CSR, but present in SSR
- Cannot properly bind numbers to Select HOT 1
- Double mounting for children element. HOT 2
- Is [email protected] active now? HOT 2
- [SSR/Astro] DOM Not Updated from State by Client Updates onMount HOT 5
- Boolean attributes HOT 1
- Component doesn't reliably respond to a signal after hydration HOT 3
- JSX does not wait for transitions to complete when using a ternary in a prop value HOT 4
- What is the minimum browser support for SolidJS? HOT 2
- TypeScript doesn't give error when calling a SetStoreFunction<T> where T is an array of objects HOT 13
- SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener' HOT 4
- When `createResource` is used to load entities, and `createStore` is used to reference those entities, updates to store properties which reference entities should not mutate the original resource.
- Attempted import error HOT 1
- Using enableScheduling in a simple solidjs-router project throws errors on transitions HOT 1
- [Bug?]: <noscript> content renders on the client HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid.