♻️ (GenericNode/index.tsx): refactor showNode state initialization and update logic to use useState and useEffect hooks for better readability and maintainability

This commit is contained in:
cristhianzl 2024-03-29 00:02:44 -03:00
commit bb7620b810

View file

@ -211,10 +211,12 @@ export default function GenericNode({
}
}, [validationStatus, validationStatus?.params]);
// const showNode = data.showNode ?? true;
const [showNode, setShowNode] = useState(data.showNode ?? true);
useEffect(() => {
setShowNode(data.showNode ?? true);
}, [data.showNode]);
const nameEditable = true;
const emojiRegex = /\p{Emoji}/u;