Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions src/hooks/useCounter/ko/useCounter.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# useCounter

`useCounter`는 숫자 카운터 상태를 증가, 감소, 초기화 기능과 함께 관리하는 리액트 훅이에요. 선택적으로, 카운터의 범위를 제한하기 위해 최소 및 최대값을 제공할 수 있어요.
`useCounter`는 증가, 감소초기화 기능을 가진 숫자 카운터 상태를 관리하는 리액트 훅이에요. 선택적으로, 카운터의 범위를 제한하기 위해 최소값과 최대값을 제공할 수 있어요.

## Interface

```ts
function useCounter(
initialValue?: number,
options?: UseCounterOptions
initialValue: number = 0,
options: UseCounterOptions
): UseCounterReturn;
```

Expand All @@ -16,30 +16,28 @@ function useCounter(
<Interface
name="initialValue"
type="number"
required={false}
defaultValue="0"
description="카운터의 초기값이에요. 기본값은 0이에요."
/>

<Interface
required
name="options"
type="UseCounterOptions"
required={false}
description="카운터의 옵션이에요."
:nested="[
{
name: 'options.min',
type: 'number',
required: false,
description:
'카운터가 도달할 수 있는 최소값이에요. 제공되지 않으면 하한선이 없어요.',
'카운터가 도달할 수 있는 최소값이에요. 제공되지 않으면, 하한선이 없어요.',
},
{
name: 'options.max',
type: 'number',
required: false,
description:
'카운터가 도달할 수 있는 최대값이에요. 제공되지 않으면 상한선이 없어요.',
'카운터가 도달할 수 있는 최대값이에요. 제공되지 않으면, 상한선이 없어요.',
},
{
name: 'options.step',
Expand All @@ -56,7 +54,7 @@ function useCounter(
<Interface
name=""
type="UseCounterReturn"
description="카운트 값과 제어 함수들이 포함된 객체에요."
description="카운트 값과 제어 함수들을 가진 객체예요."
:nested="[
{
name: 'count',
Expand All @@ -68,26 +66,26 @@ function useCounter(
name: 'increment',
type: '() => void',
required: false,
description: '카운트를 증가시키는 함수에요.',
description: '카운트를 증가시키는 함수예요.',
},
{
name: 'decrement',
type: '() => void',
required: false,
description: '카운트를 감소시키는 함수에요.',
description: '카운트를 감소시키는 함수예요.',
},
{
name: 'reset',
type: '() => void',
required: false,
description: '카운트를 초기 값으로 리셋하는 함수에요.',
description: '카운트를 초기값으로 재설정하는 함수예요.',
},
{
name: 'setCount',
type: '(value: number | ((prev: number) => number)) => void',
required: false,
description:
'카운트를 특정 값으로 설정하거나 새로운 값을 반환하는 함수에요.',
'카운트를 특정 값으로 설정하거나 새로운 값을 반환하는 함수예요.',
},
]"
/>
Expand All @@ -105,15 +103,15 @@ function ShoppingCart() {

return (
<div>
<span>Quantity: {count}</span>
<span>수량: {count}</span>
<button type="button" onClick={decrement}>
-
</button>
<button type="button" onClick={increment}>
+
</button>
<button type="button" onClick={reset}>
Reset
재설정
</button>
</div>
);
Expand Down
8 changes: 3 additions & 5 deletions src/hooks/useCounter/useCounter.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

```ts
function useCounter(
initialValue?: number,
options?: UseCounterOptions
initialValue: number = 0,
options: UseCounterOptions
): UseCounterReturn;
```

Expand All @@ -16,15 +16,13 @@ function useCounter(
<Interface
name="initialValue"
type="number"
required={false}
defaultValue="0"
description="Initial value for the counter. Defaults to 0."
/>

<Interface
required
name="options"
type="UseCounterOptions"
required={false}
description="The options for the counter."
:nested="[
{
Expand Down
Loading