Skip to content

Commit

Permalink
feat: Add example on function re-binding for class methods
Browse files Browse the repository at this point in the history
  • Loading branch information
webJose committed Dec 8, 2024
1 parent 1a0b822 commit 3e37dfa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions documentation/docs/02-runes/02-$state.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ You can either use an inline function...
</button>
```

...or re-bind the function to its object...

```svelte
<button onclick=+++{todo.reset.bind(todo)}>+++
reset
</button>
```

...or use an arrow function in the class definition:

```js
Expand Down

0 comments on commit 3e37dfa

Please sign in to comment.