From 7b627becc92fd96077be41b16c283c3706ad3aff Mon Sep 17 00:00:00 2001 From: minsoo-web Date: Tue, 14 Jan 2025 17:32:43 +0900 Subject: [PATCH] update ternary operator docs with no useMemo --- code/examples/ternary-operator.md | 4 ++-- en/code/examples/ternary-operator.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/examples/ternary-operator.md b/code/examples/ternary-operator.md index 9547e2f4..1ab536a7 100644 --- a/code/examples/ternary-operator.md +++ b/code/examples/ternary-operator.md @@ -25,7 +25,7 @@ const status = A조건 && B조건 ? "BOTH" : 둘다아닌경우 ? "NONE" : A조 다음과 같이 조건을 `if` 문으로 풀어서 사용하면 보다 명확하고 간단하게 조건을 드러낼 수 있어요. ```typescript -const status = useMemo(() => { +const status = (() => { if (A조건 && B조건) { return "BOTH"; } @@ -35,5 +35,5 @@ const status = useMemo(() => { } return "NONE"; -}, [A조건, B조건]); +}, [A조건, B조건])(); ``` \ No newline at end of file diff --git a/en/code/examples/ternary-operator.md b/en/code/examples/ternary-operator.md index 83448a18..8f8a861a 100644 --- a/en/code/examples/ternary-operator.md +++ b/en/code/examples/ternary-operator.md @@ -25,7 +25,7 @@ This code uses multiple nested ternary operators, making it difficult to quickly You can rewrite the conditions using `if` statements, as shown below, to make the logic clearer and easier to follow. ```typescript -const status = useMemo(() => { +const status = (() => { if (ACondition && BCondition) { return "BOTH"; } @@ -35,5 +35,5 @@ const status = useMemo(() => { } return "NONE"; -}, [ACondition, BCondition]); +}, [ACondition, BCondition])(); ``` \ No newline at end of file