-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 화면에 보여지는 부분 custom hook으로 분리
- Loading branch information
Showing
5 changed files
with
22 additions
and
20 deletions.
There are no files selected for viewing
8 changes: 3 additions & 5 deletions
8
frontend/src/components/Product/PBProductList/PBProductList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
frontend/src/components/Rank/ProductRankingList/ProductRankingList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
frontend/src/components/Rank/ReviewRankingList/ReviewRankingList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useLocation } from 'react-router-dom'; | ||
|
||
const useDisplaySlice = <T>(path: string, data?: T[], limit = 2): T[] => { | ||
const location = useLocation(); | ||
const isHomePage = location.pathname === path; | ||
|
||
return isHomePage ? data?.slice(0, limit) || [] : data || []; | ||
}; | ||
|
||
export default useDisplaySlice; |