Skip to content

Issue with updates #11

@adamovic6666

Description

@adamovic6666

When I add a new review, I've got this one on route change:

Cannot update a component (AverageRating) while rendering a different component (AverageRating). To locate the bad setState() call inside AverageRating, follow the stack trace as described in https://react.dev/link/setstate-in-render

src\app\products[id]\components\AverageRating.tsx (16:11) @ dispatch

  14 |   const initialized = useRef(false);
  15 |   if (!initialized.current) {
> 16 |     store.dispatch(setReviews(initialReviews));
     |           ^
  17 |     initialized.current = true;
  18 |   }
  19 |   const reviews = useReviews();

I've cloed your repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions