Skip to content

Commit be68fd6

Browse files
docs(useMap): auto-generated docs (#245)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: seungrodotlee <seungrodotlee@gmail.com>
1 parent 4ed5306 commit be68fd6

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

src/hooks/useMap/ko/useMap.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# useMap
2+
3+
리액트 훅으로, 상태로 키-값 쌍인 맵(Map)을 관리해요. 효율적인 상태 관리를 제공하고 안정적인 액션 함수를 제공해요.
4+
5+
## 인터페이스
6+
7+
```ts
8+
function useMap(initialState: MapOrEntries<K, V>): UseMapReturn<K, V>;
9+
```
10+
11+
### 파라미터
12+
13+
<Interface
14+
required
15+
name="initialState"
16+
type="MapOrEntries<K, V>"
17+
description="초기 맵 상태 (맵 객체 또는 키-값 쌍의 배열)"
18+
/>
19+
20+
### 반환 값
21+
22+
<Interface
23+
name=""
24+
type="UseMapReturn<K, V>"
25+
description="맵 상태와 이를 조작하는 액션을 포함한 튜플이에요"
26+
/>
27+
28+
## 예시
29+
30+
```tsx
31+
const [userMap, actions] = useMap<string, User>([
32+
['user1', { name: 'John', age: 30 }],
33+
]);
34+
35+
// 맵에서 값 사용하기
36+
const user1 = userMap.get('user1');
37+
38+
// 맵 업데이트하기
39+
actions.set('user2', { name: 'Jane', age: 25 });
40+
```

src/hooks/useMap/useMap.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# useMap
2+
3+
A React hook that manages a key-value Map as state. Provides efficient state management and stable action functions.
4+
5+
## Interface
6+
7+
```ts
8+
function useMap(initialState: MapOrEntries<K, V>): UseMapReturn<K, V>;
9+
```
10+
11+
### Parameters
12+
13+
<Interface
14+
required
15+
name="initialState"
16+
type="MapOrEntries<K, V>"
17+
description="Initial Map state (Map object or array of key-value pairs)"
18+
/>
19+
20+
### Return Value
21+
22+
<Interface
23+
name=""
24+
type="UseMapReturn<K, V>"
25+
description="tuple containing the Map state and actions to manipulate it"
26+
/>
27+
28+
## Example
29+
30+
````tsx
31+
```tsx
32+
const [userMap, actions] = useMap<string, User>([
33+
['user1', { name: 'John', age: 30 }]
34+
]);
35+
36+
// Using values from the Map
37+
const user1 = userMap.get('user1');
38+
39+
// Updating the Map
40+
actions.set('user2', { name: 'Jane', age: 25 });
41+
````
42+
43+
```
44+
45+
```

0 commit comments

Comments
 (0)