Comments (8)
I see 😆
To me this is the kind of cases most people won't hit and when they do, they should be able to find a forum post or issue with the reasoning.
Putting it on the docs as a tip adds mental overhead that will be useless to most users and it's something we are avoiding and, instead, trying to integrate the explanation with the guide, to make the learning experience smoother
Side note: talking about laziness, using one letters for debugging purposes is even shorter and about as bad in readability as using the spread operator 😄 :
export default {
setup(p, c) {
console.log(c)
}
}
from core.
It saves creating two proxy instances if the argument isn't used.
from core.
@KaelWD I know. But this is a trap, is it worth it? Maybe document it will help.
from core.
I don't think you are supposed to destructure the 2 arguments of setup like that.
Being able to avoid creating the Context object altogether for components not using it (all components that only rely on props) is a big perf boost. The only possible reason to use the spread like that is to pass the args again to a different function using the spread operator, so I think this is perfectly fine given the perf benefit
from core.
@posva I agree. And I think there needs to be some way to let people know about this, before they run into it, document maybe (in the future)?
from core.
How did you personally run into it and do you have any idea of other ways people will run into it? This will helps us to find the place it fits in the docs. Since most people won't use that syntax naturally nor by following the guide, it needs to be in the right place to be effective
from core.
I'm doing a small experiment, want to log both props and context, but I'm to lazy to write two parameters😅. Maybe people will write code like this when they debugging.
from core.
I got your point, nice discussion.
from core.
Related Issues (20)
- 可选的boolean类型属性的默认值有问题 HOT 2
- Discrepancy between dev and build HOT 2
- Watching a model with custom get and setter doesn't work in some cases.
- type definition for custom elements created without using vue to consume in vue app
- A separate type for the setter in Ref<T, S> can lead to nested refs HOT 1
- v-bind in CSS values are set after the component's element is already in the DOM HOT 5
- `defineModel` doesn't run if the same value is selected HOT 6
- Allow unrelated getter and setter Ref types leads to nested array type errors. HOT 7
- Event stopImmediatePropagation does not prevent other listeners from being called HOT 2
- Memory leak on last clicked input HOT 2
- Nested scope template HOT 1
- 内置的“withDirectives”API无法实现给vnode动态配置指令功能 HOT 3
- Missing support TS 5.5, without `DOM` lib in tsconfig
- Trying to dynamically set `content` of a pseudo-element (::before, ::after), renders nothing HOT 2
- Reactivity broken with setTimeout in instance constructor HOT 1
- Extended array methods are called with unexpected values HOT 2
- parameter missing in extended array find method
- ComputedRef should not be assignable to WritableComputedRef
- Inconsistent execution order of Sync Watchers on `computed` property HOT 4
- runtime prop type of `keyof SomeInterface['property']` resolves to `Object` HOT 1
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 core.