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

createSelector #277

Open
LittleSound opened this issue Sep 19, 2024 · 1 comment
Open

createSelector #277

LittleSound opened this issue Sep 19, 2024 · 1 comment

Comments

@LittleSound
Copy link
Member

LittleSound commented Sep 19, 2024

Discuss whether createSelector is needed to optimize performance.

Using functions like createSelector can reduce the time complexity of the select row item in the benchmark from O(n) to O(1).

Use createSelector in other frameworks

Here is some information about createSelector in other frameworks:

Use v-memo in Vue

It is important to note when using v-memo in Vue. We can achieve a similar effect:

<div v-for="item in list" :key="item.id" v-memo="[item.label, item.id === selected]">
  <p>{{ item.id }}: {{ item.label }} - selected: {{ item.id === selected }}</p>
  <p>...more child nodes</p>
</div>

Since v-memo is a more general API, the user experience will be somewhat different because you need to specify content other than id, such as item.label.

So what are your thoughts on this? Feel free to discuss.

@typed-sigterm
Copy link

CSS has already defined Selector, perhaps we need a more unique name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants