Skip to content

Describe inferring RootState type from store.getState #324

Closed
@markerikson

Description

@markerikson

The docs show inferring type RootState = ReturnType<typeof rootReducer>. But, if you pass the slice reducers directly to configureStore(), you never created the root reducer yourself, so you need to infer it as type RootState = ReturnType<typeof store.getState> instead.

We should update the Advanced Tutorial and Usage with TypeScript pages to mention that.

See https://stackoverflow.com/a/59827580/62937 for an example of this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions