skip to Main Content

Reactjs – My state array is not rendering at component start. I am running a conditional to not get stuck in infinite loop

import React, {useState, useEffect} from "react"; import { Grid, Card, CardContent, CardMedia, CardActionArea, Box, ButtonGroup, Button } from '@mui/material'; import abilities from "../../gameobjects/abilities"; function CharacterCard({character, actionRelay}) { const [roleabilities, setRoleAbilities] = useState([]) if(roleabilities.length === 0){ const abilitesArray = []; abilitesArray.push(abilities[character.role])…

VIEW QUESTION
Back To Top
Search