Contributing
Reporting Issues
If you encounter any issues while using useHooks, please report them on the GitHub Issues page. When reporting an issue, please provide as much detail as possible, we already made a template for you to use, so you don't have to worry about that.
Clone the Repository
Folder Structure
index.ts
index.ts
useHook.ts
useHook.demo.tsx
useHook.test.ts
tsup.config.ts
package.json
Adding Hooks
You can add a new hook by following these steps:
- Create a new folder in the
src
folder with the name of the hook. - Create a new file in the folder with the name of the hook.
- Create a new file in the folder with the name of the hook and the extension
.demo.tsx
. - Create a new file in the folder with the name of the hook and the extension
.test.ts
. - Create a new file in hook folder
index.ts
. - Export the hook in the
index.ts
file. - Export the hook from
src/index.ts
.
Writing Tests
Here's a simple example of how to add tests for a hook, you can check docs for more information.
Hook Names
Hook names must be same as the file and folder name, and all of them must be
prefixed with use
.
Actions
By opening a pull request, Github Workflows will run the following actions:
- Run
build
to bundle the entire hooks. - Run
test
to run the hooks.
You must get passing from actions so we can merge your pull request.