Skip to content

Dynamic getSubState in useStoreState #22

Closed
@richardvuu

Description

I have a case where I want to get a list of data based on some prop.

const myComponent = ({type}) => {
  let data = useStoreState(store, (s) => s[type]);
  // do stuff with data
}

However, the selector is not updating when I change the type prop. Is there any way to make this work?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions