Some how match data is from the parent class, and I initialized matches using useState(match) However, matches data is containing old data and wasn't updated as parent match data. Anyone help?
const FixtureDetailItem = ({ type, match, teams, isAdmin, postMatchesStart, putMatchesStart }) => {
console.log(match)
const [matches, setMatches] = useState(match);
const { homeTeamId, homeTeamName, homeScore, awayTeamId, awayTeamName, awayScore, scheduledAt, location, league, matchRecords} = matches;
useEffect(() => {
console.log('fired')
console.log(matches)
setMatches(matches)
}, [matches]);
setMatches(matches)usesetMatches({ ...matches }).