Skip to content

Commit

Permalink
refactor: queryParams 개선 (state 사용x)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed May 22, 2024
1 parent ba3009e commit db837eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hooks/useQueryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const useQueryParams = () => {
const searchParams = useSearchParams();
const pathname = usePathname();

const queryParams = searchParams.toString();

const getQueryParam = useCallback(
(queryKey: string) => {
const queryParam = searchParams.get(queryKey);
Expand Down Expand Up @@ -58,7 +60,7 @@ const useQueryParams = () => {
[router, searchParams, pathname]
);

return { getQueryParam, setQueryParams, removeQueryParam };
return { queryParams, getQueryParam, setQueryParams, removeQueryParam };
};

export default useQueryParams;

0 comments on commit db837eb

Please sign in to comment.