Skip to content

Instantly share code, notes, and snippets.

View videni's full-sized avatar
🎯
Focusing

vidy videni

🎯
Focusing
  • Chengdu
View GitHub Profile
@iShawnWang
iShawnWang / useRouter.ts
Last active July 27, 2019 05:52
react-router backward hooks, support react-router 4.x | 5.x
import { __RouterContext as RouterContext, RouteComponentProps } from 'react-router'
import { useContext, useMemo, useCallback } from 'react'
import qs from 'qs'
import { Location } from 'history'
interface ParsedQuery {
[whatever: string]: any
}
export const useRouter = <T>(): RouteComponentProps<T> =>