From 5c85fa6a355aa2eddc2dabd88a11e6afad8489e3 Mon Sep 17 00:00:00 2001 From: CJY Date: Mon, 11 Mar 2024 16:50:59 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mypage/component/ScoreHeader.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/mypage/component/ScoreHeader.tsx b/src/components/mypage/component/ScoreHeader.tsx index be06e04..53865e0 100644 --- a/src/components/mypage/component/ScoreHeader.tsx +++ b/src/components/mypage/component/ScoreHeader.tsx @@ -1,5 +1,5 @@ import { BackgroundColor, Primary } from '@utils/constant/color'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; import MakeAttendanceButton from './MakeAttendanceButton'; @@ -10,9 +10,12 @@ interface UserProps { const ScoreHeader = ({ isAdmin, name }: UserProps) => { const [isPre, setIsPre] = useState(false); - if (name === '최재영' || name === '박재윤') { - setIsPre(true); - } + + useEffect(() => { + if (name === '최재영' || name === '박재윤') { + setIsPre(true); + } + }, [name]); return ( <>