Skip to content

Instantly share code, notes, and snippets.

@bfollington
Created April 11, 2019 01:25
Show Gist options
  • Save bfollington/bae1ab441c044d186f8e369d9b643dcd to your computer and use it in GitHub Desktop.
Save bfollington/bae1ab441c044d186f8e369d9b643dcd to your computer and use it in GitHub Desktop.
Concise & Typesafe Redux Actions
export type Action = ReturnType<
| typeof loginRequested
| typeof logoutRequested
>
type Dispatch = React.Dispatch<Action>
export const loginRequested = (userId: string) => (<const>{
type: 'loginRequested',
payload: {
userId
},
})
export const logoutRequested = () => (<const>{
type: 'loginRequested',
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment