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

Support for Dot-Separated Paths in "withArraySelector" #7

Open
TryV opened this issue Jul 3, 2024 · 0 comments
Open

Support for Dot-Separated Paths in "withArraySelector" #7

TryV opened this issue Jul 3, 2024 · 0 comments

Comments

@TryV
Copy link

TryV commented Jul 3, 2024

I would like to suggest an enhancement for the withArraySelector function. Currently, it allows selecting state slices using an array of keys. However, it would be incredibly useful if it could also support dot-separated paths for nested state selection.

Use Case:
In many applications, state can be nested deeply. Using dot-separated paths would simplify the selection of nested state slices and improve code readability. For example:

const useStoreWithArray = withArraySelector(useExampleStore);

Current method:
const { nestedState } = useStoreWithArray(['nestedState']);

Proposed method:
const { deeplyNestedState } = useStoreWithArray(['nested.state.path']);

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