forked from narze/react-useless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_TEMPLATE.tsx
34 lines (28 loc) · 1.09 KB
/
_TEMPLATE.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// This file is a template, save this file as <yourHookName>.tsx and remove this comment
import Card from "../components/Card"
import { useLess } from "../hooks/useLess"
import { useSalim } from "../hooks/useSalim"
// Default export a functional component which includes hook's usage
// You can use our Card component or roll your own container component
export default function () {
const cardProps = {
desc: "useYourHookName - returns something yada yada yada",
examples: [
// For simple form, just pass the hook's return value
{ code: "const value = useLess(0)", value: useLess(0) },
// Or, use function component form for more complex example with buttons
() => {
const { quote: salimQuote, refetch: salimRefetch } = useSalim()
return (
<>
<code>const {"{ quote, refetch }"} = useSalim()</code>
<div>quote is {salimQuote}</div>
<button onClick={() => salimRefetch()}>Click to refetch</button>
</>
)
},
],
githubUsername: "yourGithubUsername",
}
return <Card {...cardProps} />
}