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.

question: idiomatic way to reference dispatcher and/or state?

See original GitHub issue

hi andrew,

redux-thunk facilitates referencing dispatcher and state by automatically providing the dispatcher and getState methods.

how would you recommend gaining similar references using redux-promise?

regards, tony

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
tony-kerzcommented, Nov 15, 2015

@kevana, i just tried the strategy outlined above, and the behavior i witnessed was the thunk not being executed.

the following doesn’t take i think because createAction puts the ‘thunk’ in a payload field…?

export const setSkill = createAction(
  actions.SET_SKILL,
  (skill) => {
    return (dispatch, getState) => {
      dispatch(setSkillBegin(skill))
      return getArticlesPromise(skill)
    }
  }
)

i have however had some luck with something like:

export const setSkill = (skill) => {
  return (dispatch, getState) => {
    dispatch(setSkillBegin(skill))
    dispatch(createAction(actions.SET_SKILL, getArticlesPromise)(skill))
  }
}
0reactions
davibecommented, Dec 27, 2016

I am not sure what you mean. I have a “client action creator” that can dispatch success/error depending on the outcome of the api call. I use it in many other actions so I am no really repeating that code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Untitled
R b rap love songs, Ils reference datum, Blackberry 9300 white price, ... Concept 2 rower model c assembly, How to write a...
Read more >
Untitled
Long way home 1997, Ganga telugu serial zee telugu, 29 000 mercedes. ... Amministratore stefano giannangeli, Map tile sets, Vidal art reference, ...
Read more >
Untitled - Snap!
Instead this block reports how many milliseconds it took to perform the ... ,online,system,better,three,never,always,love,say,might,next,company,state ...
Read more >
Untitled
Mac sense of style eyeliner, Motorbikes love quotes, Evolva 1-2-3 plus zebra, ... Cpa exam practice questions free, Noticias economicas 3 de febrero...
Read more >
ED262590.pdf - ERIC
Barbara Kryk (Poznan): How do proper names refer? ... St lvo Ohlandor. 1976. ... The question that we may raise now is whether...
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