From 3393d66d211dbe19942df8f268a57f4c051307e3 Mon Sep 17 00:00:00 2001 From: Stefan Chrobot Date: Sat, 17 Feb 2024 21:49:41 +0000 Subject: [PATCH] Refactor UI state: rename variables --- assets/tree/src/App.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/tree/src/App.js b/assets/tree/src/App.js index b118cd74..17422516 100644 --- a/assets/tree/src/App.js +++ b/assets/tree/src/App.js @@ -20,11 +20,11 @@ export default function App({ tree }) { } function TreeNode({ node, level }) { - const [expanded, setExpanded] = useState(shouldAutoExpand(node, level)); + const [isExpanded, setIsExpanded] = useState(shouldAutoExpand(node, level)); function handleExpandClick() { if (node.children) { - setExpanded(!expanded); + setIsExpanded(!isExpanded); } } @@ -36,21 +36,21 @@ function TreeNode({ node, level }) { >
{node.children && - (expanded ? ( + (isExpanded ? ( ) : ( ))}
- {node.children && expanded ? ( + {node.children && isExpanded ? ( ) : ( )}
- {node.children && expanded && ( + {node.children && isExpanded && ( <>
    {node.children.map((child, index) => (