Skip to content

Avoiding no-shadow eslint error #332

@johncantrell97

Description

@johncantrell97

In the intermediate tutorial you showcase a really common pattern of importing an action creator from a slice and then map it to props using connect(). I'm struggling to decide what the right way to handle this is. Since redux-toolkit seems to have some strong opinions I was hoping for one about this topic.

There's a great answer on SO about this same topic ( https://stackoverflow.com/a/42337137 ).

I'm leaning towards his #1 solution of just disabling this eslint rule in my project. His #3 violates react/destructuring-assignment eslint rule.

Only other option imo is #2 where you rename the connected action creator with some strict naming convention but that just doesn't feel great to me either.

What do the folks here recommend? Based on the tutorial it seems you would also lean towards just allowing variable shadowing in this case?

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