Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get accessor in props #125

Open
d8corp opened this issue Jun 19, 2020 · 1 comment
Open

Get accessor in props #125

d8corp opened this issue Jun 19, 2020 · 1 comment
Labels
Proposal Proposals (haven't confirmed)

Comments

@d8corp
Copy link

d8corp commented Jun 19, 2020

Could you add a syntaxis to have get accessor in props?

let count = 0
const test = <div test=${count++} />

I wanna increase the count each time I get the property of test.

const props = {
  get test () {
    return count++
  }
}

It will help to change one attribute of element instead of full rerendering (all attributs and childrens)

@QbDesu
Copy link

QbDesu commented Oct 17, 2021

Let's review the technical requirements that would be necessary to implement such a feature:
In order for this to work intrinsics <a href=${this.b}> as well as components <MyComponent someProp=${this.b}> it would require passing the props as a proxy with overridden get accessors for the prop in question.
Not to mention a couple of things would break. What would cause the child component to rerender if the value changes? Implications for the lifecycle of the child,.. etc.

@Huxpro Huxpro added the Proposal Proposals (haven't confirmed) label Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Proposals (haven't confirmed)
Projects
None yet
Development

No branches or pull requests

3 participants