0

I am redirecting on my unique component and I want my data in my context api to be rendered matching with the params that I passed.

Here is the code to my Component;

export default function BasketballScoreboard() {
  const dataContext = useContext(DataContext);

  let { matchId } = useParams();
  let nowMatch = dataContext.liveMatchList.filter(
    (match) => match._id === matchId
  );

  if (!dataContext.isLoaded) {
    return <Grid>Loading...</Grid>;
  } else {
    return <div>{nowMatch}</div>;
  }
}

When I log it, it returns an empty array but when I do make something like that to another component like a dashboard it returns the expected data.

0 Answers0