https://github.com/ryohidaka/gitbeaker-hooks
React Hooks library for Gitbeaker.
https://github.com/ryohidaka/gitbeaker-hooks
git gitbeaker gitlab react react-hooks
Last synced: 3 months ago
JSON representation
React Hooks library for Gitbeaker.
- Host: GitHub
- URL: https://github.com/ryohidaka/gitbeaker-hooks
- Owner: ryohidaka
- License: mit
- Created: 2024-03-31T22:53:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-10T04:25:03.000Z (over 1 year ago)
- Last Synced: 2025-10-25T04:55:11.311Z (8 months ago)
- Topics: git, gitbeaker, gitlab, react, react-hooks
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/gitbeaker-hooks
- Size: 223 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# gitbeaker-hooks
[](https://badge.fury.io/js/gitbeaker-hooks)

[](https://codecov.io/gh/ryohidaka/gitbeaker-hooks)
[](https://opensource.org/licenses/MIT)
[](https://ko-fi.com/B0B6TVH92)
## Overview
React Hooks library for [Gitbeaker](https://github.com/jdalrymple/gitbeaker).
## Installation
You can install this library using npm:
```shell
npm install gitbeaker-hooks
```
## Usage
Wrap your app with the `GitbeakerProvider` and provide options object with `token` property.
```tsx
import { GitbeakerProvider } from "gitbeaker-hooks";
const gitbeakerOptions = {
token: "your-access-token",
};
ReactDOM.render(
,
document.getElementById("root"),
);
```
Use the provided hooks to fetch GitLab data:
- useProjects
- useRepositoryTrees
- useBranches
```tsx
import { useProjects } from "gitbeaker-hooks";
function App() {
const { projects, isLoading } = useProjects();
if (isLoading) {
return
Loading...;
}
return (
<>
- {project.name} )}
{projects?.map((project) =>
>
);
}
export default App;
```
## API
### Hooks
- `useProjects(options)` - Fetch multiple projects.
- `useRepositoryTrees(projectId, options)` - Get a list of repository files and directories in a project.
- `useBranches(projectId, options)` - Get a list of repository branches from a project, sorted by name alphabetically.
### GitbeakerProvider
The `GitbeakerProvider` component should be used to wrap your app and provide the `options` object. The `options` object must include the `token` property.
## Link
- [Gitbeaker](https://github.com/jdalrymple/gitbeaker)
- [@gitbeaker/rest](https://www.npmjs.com/package/@gitbeaker/rest)
- [Docs for GitLab REST API](https://archives.docs.gitlab.com/16.4/ee/api/rest/)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.