Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document performance implications of ownProps and a workaround #1603

Closed
gaearon opened this issue Apr 12, 2016 · 6 comments
Closed

Document performance implications of ownProps and a workaround #1603

gaearon opened this issue Apr 12, 2016 · 6 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Apr 12, 2016

Relying on ownProps in mapStateToProps disables some optimizations in React Redux.
We should mention this in the docs of both projects, and also include this neat tip on how ownProps can be avoided for many cases.

Contributions are welcome!

@gaearon
Copy link
Contributor Author

gaearon commented Apr 12, 2016

Example of this in practice: mweststrate/redux-todomvc@e5d25f0
Gives ~3x perf boost in my testing.

@gaearon
Copy link
Contributor Author

gaearon commented Apr 12, 2016

In fact a lot of thinking in mweststrate/redux-todomvc#1 is non-obvious to beginners and even advanced users. We should have an optimization guide that explains how to find the optimization sweet spots and use them.

@markerikson
Copy link
Contributor

Yeah. That and a "Structuring Reducers" recipe would be great additions to the docs. I'm kinda busy at the moment, but might be able to help out at some point.

As a side note, I'm rather amused to see that you've adopted strictly passing IDs to children as a viable option for some use cases, given a couple of your earlier comments against it. :)

Obviously reasons to do both, depending on the situation.

@gaearon
Copy link
Contributor Author

gaearon commented Apr 12, 2016

It really depends on whether I’m trying to keep components more reusable or optimize the hell out of their updates.

@zhiyelee
Copy link

Great! thanks @gaearon

@timdorr
Copy link
Member

timdorr commented Sep 27, 2016

Let's roll this up into #1783. It should definitely be covered there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants