question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change `update` to `getState`

See original GitHub issue

In thunks, we do not know the current state because maybe some other actions has changed the state during the thunk. So you offered an update function.

But a better solution is offer a getState function…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
xialvjuncommented, Oct 23, 2017

got it. thanks very much.

0reactions
jorgebucarancommented, Oct 23, 2017

Glad you figured it out! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

redux getState() doesn't return the updated state
The problem that made me stuck for days is that although my redux devtool shows the successful state update without any kind ...
Read more >
Actions and reducers: updating state - Human Redux
The simplest possible way to update a view is just store.subscribe() and then in that function, call store.getState() and re-render. ... For our...
Read more >
Store - Redux
Dispatches an action. This is the only way to trigger a state change. The store's reducing function will be called with the current...
Read more >
Why React doesn't update state immediately - LogRocket Blog
State updates in React are asynchronous; when an update is requested, there is no guarantee that the updates will be made immediately.
Read more >
React setState does not immediately update the state - Medium
React setState does not immediately update the state · React State · useState React hook · How we can setState and get state...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found