Skip to content

useSelector API reference is self-contradictory #1531

@nikparo

Description

@nikparo

Do you want to request a feature or report a bug?
bug

The useSelector API reference states two things that contradict each other:

  • When an action is dispatched, useSelector() will do a shallow comparison of the previous selector result value and the current result value. If they are different, the component will be forced to re-render. If they are the same, the component will not re-render.
  • useSelector() uses strict === reference equality checks by default, not shallow equality (see the following section for more details).

What is the current behavior?
useSelector() uses strict === reference equality checks by default, not a shallow comparison.

What is the expected behavior?
The docs should probably be amended to say something like this instead:

  • When an action is dispatched, useSelector() will do a shallow comparison of compare the previous selector result value and the current result value. If they are deemed different, the component will be forced to re-render. If they are the same Otherwise, the component will not re-render.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions