Feature request: add previous global state to addCallback parameters
See original GitHub issueFirst of all let me tell you how I love this library. It is simple, powerful and made my work much, much better and enjoyable. Thanks mate!
To the point now.
I am having a case where I would like to call a certain function whenever I update the global state, but only when a particular property of the state has been changed.
I thought that the addCallback
helper function could help me. The thing is that I cannot compare the new state with the previous one. Is it difficult to add the prevGlobal
as the second parameter of the addCallback
helper function?
Or maybe there is some other approach I did not think of?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
CharlesStover/reactn: React, but with built-in global ... - GitHub
Use addReducer to add a reducer to your global state. The first parameter is the name of your reducer. You will access your...
Read more >Provide custom back navigation - Android Developers
This usually allows Android to properly navigate to previous destinations when the Back button is pressed. However, there are a few cases ...
Read more >Call Back [Cisco Unified Communications Manager ...
Perform this step to add CallBack softkey to template and configure the softkey using the Common Device Configuration or phone.
Read more >React hooks: accessing up-to-date state from within a callback
I need to call setState to access the previous state. Even though I have no intention of setting the state. I feel like...
Read more >msrestazure.azure_operation.AzureOperationPoller class
Methods. add_done_callback. Add callback function to be run once the long running operation has completed - regardless of the status of the operation....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@monteiz Would you be able to unblock yourself with something like this?
I solved it.
Actually the
addCallback
helper function has an undocumented 2nd and a 3rd parameters, which are - respectively - thedispatcherMap
and thestateChange
.With the
stateChange
parameter I could very easily achieve what I was after.I am more and more amazed by the elegance of this library.
@CharlesStover if you want, I can submit a pull request with the documentation updated.