Skip to content

Commit 9accb0b

Browse files
committed
update doc
1 parent 7a0306c commit 9accb0b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/content/docs/useform/subscribe.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,17 @@ export default function App() {
5959
const { register, subscribe } = useForm<FormInputs>()
6060

6161
useEffect(() => {
62-
subscribe({
62+
// make sure to unsubscribe;
63+
const callback = subscribe({
6364
callback: ({ values }) => {
6465
console.log(values);
6566
}
6667
})
68+
69+
return () => callback();
70+
71+
// You can also just return the subscribe
72+
// return subscribe();
6773
}, [subscribe])
6874

6975
return (

0 commit comments

Comments
 (0)