Skip to content

Instantly share code, notes, and snippets.

@gaperton
Last active April 23, 2019 21:41
Show Gist options
  • Save gaperton/05aaa6fa2e59fa3409c9ffe7105d3d17 to your computer and use it in GitHub Desktop.
Save gaperton/05aaa6fa2e59fa3409c9ffe7105d3d17 to your computer and use it in GitHub Desktop.
Reach Hooks into NestedLink
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