facebookarchive / redux-react-hook

React Hook for accessing state and dispatch from a Redux store
MIT License
2.16k stars 103 forks source link

add custom dispatch type #52

Closed zebratt closed 5 years ago

zebratt commented 5 years ago

In order to inject my custom dispatch type. For example i'm using rematch, and the type of rematch dispatch is not the same as redux dispatch.

import { init, RematchRootState } from '@rematch/core'
import { useDispatch } from 'redux-react-hook'

export const store = init({
    models
})

export type Store = typeof store
export type IDispatch = typeof store.dispatc

const dispatch = useDispatch<IDispatch>()

// so that i can enable autocomplete of dispatch
dispatch.app.updateSomething({})
facebook-github-bot commented 5 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 5 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!