Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
MattisAbrahamsson committed May 3, 2024
1 parent 6f5bcd1 commit e974bfe
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,35 @@ export type Options = {

export default myFunction(parameters: Options) {...}
```

### no-use-prefix-for-non-hook

Custom hooks are identified using a `use` prefix, naming normal functions, variables or others with a `use` prefix can cause confusion.

This rule forbids functions and variables being prefixed with `use` if they do not contain other hooks.

Examples of valid code

```js
const useCustom = () => {
const [state, setState] = useState("");

return { state, setState };
};

const useCustom = () => useState("");

const useCustom = useState;
```

Examples of invalid code

```js
const useCustom = () => {
return "Hello world";
};

const useCustom = () => new Date();

const useCustom = new Date();
```

0 comments on commit e974bfe

Please sign in to comment.