import { useLocalStorage } from 'react-use';

export const USERNAME_LOCAL_STORAGE_KEY = 'USERNAME';

interface User {
  username: string;
}

const useUser = () => {
  return useLocalStorage<User | undefined>(USERNAME_LOCAL_STORAGE_KEY);
};

export default useUser;

import { useLocalStorage } from 'react-use';

export const USER_LOCAL_STORAGE_KEY = 'USER';

interface User {
  username: string;
}

const useUser = () => {
  return useLocalStorage<User | undefined>(USER_LOCAL_STORAGE_KEY);
};

export default useUser;

Change user local storage key
Change user local storage key
