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

Use reselect in Discovery #22

Open
landabaso opened this issue Oct 15, 2022 · 0 comments
Open

Use reselect in Discovery #22

landabaso opened this issue Oct 15, 2022 · 0 comments

Comments

@landabaso
Copy link
Member

landabaso commented Oct 15, 2022

For all the getter functions, since this.discovery is pure, it is trivial to use reselect and optimize for performance.

Is it worth it?

Read more here:

https://github.com/reduxjs/reselect#createselectorinputselectors--inputselectors-resultfunc

https://redux.js.org/usage/deriving-data-selectors

In case of using Discovery selectors to create arrays (that do not change) that will be used in the App, this trick may be handy:

import { shallowEqual, useSelector } from 'react-redux;'
const selectedData = useSelector(selectorReturningObject, shallowEqual);

The code above will return always the same array.

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

1 participant