File size: 348 Bytes
0e11366
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import { useState } from "react";
export const useSessionId = () => {
  const [sessionId] = useState(() => {
    const existing = localStorage.getItem("pulsemaps_session");
    if (existing) return existing;
    const fresh = crypto.randomUUID();
    localStorage.setItem("pulsemaps_session", fresh);
    return fresh;
  });
  return sessionId;
};