Skip to content

Commit 9162406

Browse files
committed
updated README for branch hooks
1 parent 2948a4f commit 9162406

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@ import { useRepos } from "@d2k/react-github";
2222
function MyComponent() {
2323
const { repos, loading, error } = useRepos("nat");
2424

25-
return (
26-
<div>
27-
{loading && <div>Loading repositories</div>}
28-
{error && <div>{err}</div>}
29-
{repos &&
30-
repos.length > 0 &&
31-
repos.map(repo => <div key={repo.id}>{repo.name}</div>)}
32-
</div>
33-
);
25+
// your component
3426
}
3527
```
3628

@@ -42,17 +34,30 @@ import { useUser } from "@d2k/react-github";
4234
function MyComponent() {
4335
const { user, loading, error } = useUser("nat");
4436

45-
return (
46-
<div>
47-
{loading && <div>Loading repositories</div>}
48-
{error && <div>{err}</div>}
49-
{user && (
50-
<div>
51-
<h1>{user.login}</h1>
52-
<img src={user.avatar_url} />
53-
</div>
54-
)}
55-
</div>
56-
);
37+
// your component
38+
}
39+
```
40+
41+
### Get branches from repo
42+
43+
```js
44+
import { useBranches } from "@d2k/react-github";
45+
46+
function MyComponent() {
47+
const { branches, loading, error } = useBranches("facebook", "react");
48+
49+
// your component
50+
}
51+
```
52+
53+
### Get branch from repo
54+
55+
```js
56+
import { useBranch } from "@d2k/react-github";
57+
58+
function MyComponent() {
59+
const { branch, loading, error } = useBranch("facebook", "react", "master");
60+
61+
// your component
5762
}
5863
```

0 commit comments

Comments
 (0)