Skip to content

reactuse.json ​

Configuration for your project.

The reactuse.json file holds configuration for your project.

We use it to understand how your project is set up and how to generate hooks customized for your project.

INFO

Note: The reactuse.json file is optional and only required if you're using the CLI to add hooks to your project. If you're using the copy and paste method, you don't need this file.

You can create a reactuse.json file in your project by running the following command:

bash
npx useverse@latest init

See the CLI section for more information.

ts ​

Choose between TypeScript or JavaScript hooks.

Setting this option to false allows hooks to be added as JavaScript with the .jsx file extension.

json
{
  "ts": "true | false"
}

aliases ​

The CLI uses these values and the paths config from your tsconfig.json or jsconfig.json file to place generated hooks in the correct location.

Path aliases have to be set up in your tsconfig.json or jsconfig.json file.

INFO

Important: If you're using the src directory, make sure it is included under paths in your tsconfig.json or jsconfig.json file.

aliases.utils ​

Import alias for your utility functions.

json
{
  "aliases": {
    "utils": "@/utils/lib"
  }
}

aliases.hooks ​

Import alias for your hooks.

json
{
  "aliases": {
    "hooks": "@/shared/hooks"
  }
}