ウェブエンジニア問題集

以下のコードを実行すると「Rendered more hooks than during the previous render」というエラーが発生します。原因として正しいものはどれですか? function UserProfile({ isLoggedIn }) { if (isLoggedIn) { const [name, setName] = useState(''); } const [age, setAge] = useState(0); return <div>{age}</div>; }