-
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(frontend): Use 'useProfile' hook to manage profile state
Introduce and employ 'useProfile' hook in 'ProfileNav' to organize profile state management. Changes include removal of 'currentProfile' state variable in favor of state provided by custom hook, modifications in method calls and variable usage to align with the new state organization. This aims to make the current profile state accessible for other components as well. Refs: #1
- Loading branch information
Showing
2 changed files
with
20 additions
and
10 deletions.
There are no files selected for viewing
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,11 @@ | ||
import { create } from 'zustand'; | ||
|
||
interface ProfileStore { | ||
current: string; | ||
setCurrent: (profile: string) => void; | ||
} | ||
|
||
export const useProfile = create<ProfileStore>((set) => ({ | ||
current: '', | ||
setCurrent: (profile) => set(() => ({ current: profile })), | ||
})); |