Skip to content

Hw 10#14

Open
AntonV1211 wants to merge 7 commits into
masterfrom
hw-10
Open

Hw 10#14
AntonV1211 wants to merge 7 commits into
masterfrom
hw-10

Conversation

@AntonV1211

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/components/cart/CartItem.jsx Outdated
Comment thread src/components/menu/MenuItem.jsx Outdated
Comment thread src/components/menu/MenuTab.jsx Outdated
Comment thread src/components/menu/MenuTab.jsx Outdated
Comment thread src/components/restaurant/RestaurantDetailsLayout.jsx Outdated
Comment thread src/components/reviewForm/ReviewForm.jsx Outdated
Comment thread src/components/reviews/Review.jsx Outdated
Comment thread src/components/reviewForm/ReviewForm.jsx Outdated
Comment thread src/components/reviews/Review.jsx Outdated
Comment thread src/components/reviews/ReviewsTab.jsx Outdated
Comment thread src/components/reviews/ReviewsTab.jsx Outdated
Comment thread src/redux/request_status/requestStatus.js Outdated
Comment thread src/components/reviews/Reviews.jsx Outdated
@AntonV1211 AntonV1211 requested a review from zubkov7 June 23, 2025 09:02

useEffect(() => {
if (restaurant && location.pathname === `/restaurants/${restaurantId}`) {
React.useEffect(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше импортировать напрямую useEffect, так будет лучше работать tree shaking

// Сброс формы при смене режима
useEffect(() => {
if (!isEditing) onCancelEdit?.();
}, [editingReview]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

массив зависимости неправильно указан

Comment on lines +19 to +22
React.useEffect(() => {
setText(initialValues.text || '');
setRating(initialValues.rating || 1);
}, [initialValues]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для чего нужно? задается в initial value для состояния

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему решили вместо useReducer использовать?

const review = useSelector(state => selectReviewById(state, reviewId));
const user = useSelector(state => selectUserById(state, review?.userId));
export const Review = ({ review, userId, onEdit }) => {
const { data: users } = useGetUsersQuery();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно грузить в родителе, чтобы каждый отзыв не инициализировал запрос

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants