reduxjs / react-redux

Official React bindings for Redux
https://react-redux.js.org
MIT License
23.38k stars 3.36k forks source link

Put Back Ability to Send in Store as a Prop to Connected Component in (v6 restricts this now) #1142

Closed dschinkel closed 5 years ago

dschinkel commented 5 years ago

This nonsense calling the ability to pass in store via as legacy and forcing people down one path.

I use shallow when I TDD connected components. Sounds like we can't still send in store as a prop from a shallow test to a connected component. That's bad because I do not want isolated tests all be broken now that this no longer works and furthermore, I rely on my style of testing to test this way. There's no reason that should be prohibited if you don't use context API. And again contextAPI forces me to use mount with enzyme which forces me to use provider. We can't use shallow anymore as things with React and Redux progress this way.

This directly relates to testing because to test a connected component with Context API, you have to mount() and reliant in your tests on using a provider. With enzyme, I do not want to use mount or provider in my tests, just shallow and simply passing in a dummy store. My tests don't test re-renders or stuff that's integration testing like that. I don't rely on integration tests so the way I test is via TDD with shallow. Preventing passing in a store as a prop is a big problem for devs doing so and I know others who also TDD this way and drive their design and inject stores this way through isolated or smaller component tests.

We don't all view context API as a good thing. Not being able to keep my tests simple by passing in the store is ridiculous which is a major reason I don't have provider in my tests to begin with. Simplicity! To be forced down this past is a very bad play on the React and Redux team. My tests should not be coupled to the implementation this much forcing one way to do it all.

Keep the simplicity. Stop trying to add more and more magic.

btnwtn commented 5 years ago

https://blog.isquaredsoftware.com/2018/11/react-redux-history-implementation/#implementation-notes-1

timdorr commented 5 years ago

Please don't be mean to other users.

timdorr commented 5 years ago

Note: There was an additional comment after @btnwtn's, but it will no longer be visible as Dave has been blocked from this project. Sorry you had to deal with a rude user, Brandon!