diff --git a/examples/react/todo.html b/examples/react/todo.html index ad2b72f7..05d36303 100644 --- a/examples/react/todo.html +++ b/examples/react/todo.html @@ -13,10 +13,10 @@ const [todos, setTodos] = React.useState({}) React.useEffect(() => { - gun + return gun .get("todos") .map() - .on((todo, id) => setTodos(todos => ({...todos, [id]: todo }))); + .on((todo, id) => setTodos(todos => ({...todos, [id]: todo }))).off; }, []) return (