Skip to content

Add docs for testing Redux with hooks (e.g. useSelector, useDispatch, etc) and React Router and ++ #570

Closed
@kimfucious

Description

@kimfucious

Is your feature request related to a problem? Please describe.
First off, I should say that this is an excellent testing library, and I do appreciate all the work that has gone into it.

That said, I'm always frustrated when I try to use React Testing Library on a project where I'm using the following setup:

  • Create React App
  • Redux, using combined reducers and Thunk middleware
  • State in all components is being accessed via useSelector hook (not using connect anymore)
  • Actions being dispatched with useDispatch hook

I start to try and write tests, and them I'm like, "Oh, yeah... this is why I'm always frustrated."

Then I read this, and try to think, "Ugh, I'm not using a single reducer, and I ain't got no initialState either."

So then I try to jam rootReducer in to see what will happen, and then, and then, and then it's a trip down a Google rabbit-hole and a couple hours of frustration, and then I give up.

Describe the solution you'd like
I'd love some docs that covered testing an app that implements Redux, using combined reducers and hooks (e.g. useSelector & useDispatch).

🤯 Even better would be a "kitchen sink" example that did everything, including Redux and React Router together with Thunk in Action Creators, and, and, and, ++.

I realize that this probably comes off as a bit whiney, but it's kinda meant to sound like that, because I'm like a kid that wants to play with a toy that's beyond his age range.

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