Skip to content

Add a dev-mode warning to createSlice to error if initialState is undefined #2459

@markerikson

Description

@markerikson

I've seen some folks misspell initialState, and thus end up with no initial state.

This leads to combineReducers doing the "Reducer x returned undefined blah blah" error, but it's not as helpful as it could be.

We should throw a dev-mode error inside of createSlice itself if the initial state is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions