Skip to content

Commit

Permalink
feat: 🎸 support server-side rendering in useSearchParam() hook
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Sep 1, 2019
1 parent 481e807 commit 64ac924
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/useSearchParam.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `useLocation`
# `useSearchParam`

React sensor hook that tracks browser's location search param.

Expand Down
4 changes: 3 additions & 1 deletion src/useSearchParam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ const useSearchParam: UseQueryParam = param => {
return value;
};

export default useSearchParam;
const useSearchParamServer = () => null;

export default typeof window === 'object' ? useSearchParam : useSearchParamServer;

0 comments on commit 64ac924

Please sign in to comment.