1// useUnique.js
2export function useUnique(initial) {
3 const [items, setItems] = useState(initial);
4 const add = newItem => {
5 const uniqueItems = [...new Set([...items, newItem])];
6 setItems(uniqueItems);
7 };
8 return [items, add];
9};