Skip to content

Commit 7e5af2d

Browse files
committed
refactor(docs): adds documentation to hooks
1 parent d585468 commit 7e5af2d

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/lib/useArticles.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import { useEffect, useState } from "react";
22

33
import { IArticlesResponse, IPost } from "..";
44

5+
/**
6+
* Returns a list of articles
7+
* @param page filter articles by pagination
8+
* @param tag filter articles by tag
9+
* @param username receive articles by username
10+
*/
511
export default function useArticles(
612
page?: string,
713
tag?: string,

src/lib/useFollowSuggestions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { useEffect, useState } from "react";
22

33
import { IFollowSuggestionsResponse, IUser } from "..";
44

5+
/**
6+
* returns follow suggestions for new users
7+
*/
58
export default function useFollowSuggestions(): IFollowSuggestionsResponse {
69
const [suggestions, setSuggestions] = useState<IUser[]>([]);
710
const [loading, setLoading] = useState(false);

src/lib/useTags.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { useEffect, useState } from "react";
22

33
import { ITag, ITagsResponse } from "..";
44

5+
/**
6+
* returns a list of tags
7+
* @param page filter by pagination
8+
*/
59
export default function useTags(page?: number): ITagsResponse {
610
const [tags, setTags] = useState<ITag[]>([]);
711
const [loading, setLoading] = useState(false);

src/lib/useUser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { useCallback, useState } from "react";
22

33
import { IUser, IUserResponse } from "..";
44

5+
/**
6+
* returns a dev.to user by either the username or id
7+
* @param username the users username
8+
* @param id the users id
9+
*/
510
export default function useUser(username?: string, id?: string): IUserResponse {
611
const [user, setUser] = useState<IUser | undefined>();
712
const [loading, setLoading] = useState(false);

0 commit comments

Comments
 (0)