Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
How are you supposed to flowtype redux thunk?

What I'm currently doing is:

export type Action =
   { type: 'FOO' }
 | { type: 'BAR' }

export type Thunk = (dispatch: Dispatch, getState: GetState) => Action | Thunk 

export type Dispatch = ReduxDispatch<Action> & (action: Thunk) => void

but if you dispatch directly on the store, that won't work without recreating store:

export type Store = ReduxStore<State, Action>

In general, my thunk solution seems to have other minor problems. Does anyone have a working library definition for redux-thunk? I can't find one anywhere.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The best example I've found so far are the ones used in Facebook's own F8 app here.

It's pretty similar to yours:

export type Dispatch = (action: Action | ThunkAction | PromiseAction | Array<Action>) => any;
export type GetState = () => Object;
export type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
export type PromiseAction = Promise<Action>;

It's worked pretty well for me so far in my project, though I don't dispatch directly on the store anywhere.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!