Add optional handleChange param get data from listeners for profiling #194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This started off from a discussion in reduxjs/redux#980
As far as I can tell there is no way to get the information that I need from listeners using the approach suggested by @gaearon, but if we have the
handleChange
return some data for us then it's straightforward.The approach I took here is to have
handleChange
take an optional parameter which is a function that should extract the data we need, given the wrapped component's name, thenextState
, and to leave the door open to other requirements, the instance of the connect component itself.If this or some variation of this is accepted, it would be great to also do a point release for 3.x in order to support React Native right away (which is the context where I am using this).
An example of how you might use this:
The result: