Skip to content

Commit

Permalink
fix(useHistory): patch when is client
Browse files Browse the repository at this point in the history
  • Loading branch information
lmhcoding committed Oct 1, 2020
1 parent 47edcd1 commit 230290d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/useHistory.ts
Expand Up @@ -22,8 +22,10 @@ function patchHistoryMethod(method: PathMethod): void {
)
}

patchHistoryMethod('pushState')
patchHistoryMethod('replaceState')
if (typeof window !== 'undefined') {
patchHistoryMethod('pushState')
patchHistoryMethod('replaceState')
}

export interface IHistoryState {
state: any
Expand Down

0 comments on commit 230290d

Please sign in to comment.