mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 18:01:08 +01:00
Refactor desktop app into separate client and proxy apps
This commit is contained in:
8
apps/yaak-client/hooks/useRandomKey.ts
Normal file
8
apps/yaak-client/hooks/useRandomKey.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { generateId } from '../lib/generateId';
|
||||
|
||||
export function useRandomKey(initialValue?: string) {
|
||||
const [value, setValue] = useState<string>(initialValue ?? generateId());
|
||||
const regenerate = useCallback(() => setValue(generateId()), []);
|
||||
return [value, regenerate] as const;
|
||||
}
|
||||
Reference in New Issue
Block a user