Last active
April 23, 2019 21:41
-
-
Save gaperton/05aaa6fa2e59fa3409c9ffe7105d3d17 to your computer and use it in GitHub Desktop.
Reach Hooks into NestedLink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useLink } from 'valuelink' | |
function Example() { | |
const counter = useLink(0); | |
return ( | |
<div> | |
<p>You clicked {counter.value} times</p> | |
<button onClick={counter.action( x => x + 1 )}> | |
Click me | |
</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment