Skip to content

Commit

Permalink
improve effects example slightly (#13)
Browse files Browse the repository at this point in the history
Just adds a line to release anything that might be held in a closure by the cleanup function.
  • Loading branch information
benlesh committed May 22, 2024
1 parent 30211ee commit aeeb2bd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function effect(callback) {
return () => {
w.unwatch(computed);
typeof cleanup === "function" && cleanup();
cleanup = undefined;
};
}
```
Expand Down

0 comments on commit aeeb2bd

Please sign in to comment.