Using `tracked` without decorators
See original GitHub issueIt could be useful to have docs about using tracked in function form instead of decorator form. experimentalDecorators from TypeScript and decorators from ECMAScript proposal are not the same thing. Also it’ll be useful for people who prefer to use current version of JavaScript.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
@track Decorator Is No Longer Required for Lightning Web ...
There is a piece of good news, we do not need to guess about whether to use @track to make a field reactive....
Read more >The @track Decorator Is No Longer Required for Lightning ...
We have removed the @track decorator from all the variables in our test project, but it was not working for the few variables....
Read more >LWC Fundamentals: The @track Decorator - YouTube
In this Quick Take, we continue our learning on JavaScript Decorators in LWC by exploring properties with the @ track Decorator.
Read more >Decorators - Salesforce Lightning Component Library
To tell the framework to observe changes to the properties of an object, decorate the field with @track . See Reactivity for Fields,...
Read more >Decorators in Lightning Web Component (LWC)
The fundamental way detects the DOM changes is through tracked properties. Tracked properties are just like normal properties on your component ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Well, AFAICT, it should be possible to do this without decorators (but using the exported decorator function) already:
Am I missing something?
@chicoxyzzy The approach used by MobX would not be a good fit for Glimmer, I don’t think. One cool thing about how tracked properties work right now is that the getter and setter are only configured one time per component, on the prototype. This makes instantiating a new component instance very cheap because there’s almost no work to do.
In the
extendObservableAPI, there’s a non-trivial cost at class construction time.I’m definitely not opposed to offering a non-decorator API for configuring tracked properties, but we would need to come up with something that is both ergonomic and maintains the semantics and performance characteristics of the decorator API.