From 64ac924edf8f71c578fdfd7b9f902aadc60bf68b Mon Sep 17 00:00:00 2001 From: streamich Date: Sun, 1 Sep 2019 23:07:43 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20support=20server-side=20?= =?UTF-8?q?rendering=20in=20useSearchParam()=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/useSearchParam.md | 2 +- src/useSearchParam.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/useSearchParam.md b/docs/useSearchParam.md index d2586a48be..f118467656 100644 --- a/docs/useSearchParam.md +++ b/docs/useSearchParam.md @@ -1,4 +1,4 @@ -# `useLocation` +# `useSearchParam` React sensor hook that tracks browser's location search param. diff --git a/src/useSearchParam.ts b/src/useSearchParam.ts index b7107e3f32..bc92a60e1d 100644 --- a/src/useSearchParam.ts +++ b/src/useSearchParam.ts @@ -26,4 +26,6 @@ const useSearchParam: UseQueryParam = param => { return value; }; -export default useSearchParam; +const useSearchParamServer = () => null; + +export default typeof window === 'object' ? useSearchParam : useSearchParamServer;