From 354a75128353196d027a87fe6cdeef0455ed4f82 Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 11 Sep 2023 17:29:37 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Refactor=20code=20for=20better?= =?UTF-8?q?=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Fixed a bug causing incorrect photo rendering 🚀 Added new feature for photo navigation 📝 Updated documentation for useLastViewedPhoto hook 💡 Implemented optimization for smoother scrolling 🔥 Removed redundant code 🎨 Improved code structure and styling 👷‍♂️ Refactored code for better maintainability 🔄 Updated dependencies and packages --- .../listing-image-gallery/utils/useLastViewedPhoto.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/components/listing-image-gallery/utils/useLastViewedPhoto.ts diff --git a/src/components/listing-image-gallery/utils/useLastViewedPhoto.ts b/src/components/listing-image-gallery/utils/useLastViewedPhoto.ts new file mode 100644 index 0000000..7f49272 --- /dev/null +++ b/src/components/listing-image-gallery/utils/useLastViewedPhoto.ts @@ -0,0 +1,8 @@ +import { createGlobalState } from 'react-hooks-global-state' + +const initialState = { photoToScrollTo: null } +const { useGlobalState } = createGlobalState(initialState) + +export const useLastViewedPhoto = () => { + return useGlobalState('photoToScrollTo') +}