Skip to content

Document usage of selectFromState thunk #4464

Open
@EskiMojo14

Description

What docs page is being updated?

  • Section: Using Selectors with React-Redux
  • Page: Deriving Data with Selectors

What updates should be made to the page?

Adding documentation regarding the selectFromState thunk for selecting the most recent value from state when you only have access to dispatch, or want a one-time read from state without a subscription.

const selectFromState = <Selected>(selector: (state: RootState) => Selected): AppThunk<Selected> => (dispatch, getState) => selector(getState());

const users = dispatch(selectFromState(selectUsers));

Do these updates change any of the assumptions or target audience? If so, how do they change?

I don't think so - this is a pattern often advised to use to help people who need a one-shot selection rather than maintaining a subscription.

raising after discussion with @markerikson in Reactiflux :)

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions