          } catch (error) {
                                console.error('Error in useLocalState subscriber:', error);
                            }
                        });
                    }
                };

                getter.subscribe = (callback) => {
                    subscribers.add(callback);
                    return () => subscribers.delete(callback);
                };

                return [getter, setter];
            }

            const api = {
                useState,
   