Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/home task 4 #67

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Bogdan1988
Copy link

No description provided.

@@ -46,4 +47,8 @@ Restaurant.propTypes = {
}).isRequired,
};

export default Restaurant;
const mapStateToProps = (state) => ({
allReviews: state.reviews,
Copy link
Owner

Choose a reason for hiding this comment

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

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


const tabs = useMemo(
() => restaurants.map(({ id, name }) => ({ id, label: name })),
() => Object.keys(restaurants).map((key) => {
Copy link
Owner

Choose a reason for hiding this comment

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

это вычисление лучше перенести в селекторы


export default (store) => (next) => (action) => {
if (action.type === ADD_REVIEW) {
action.payload.id = uuidv4();
Copy link
Owner

Choose a reason for hiding this comment

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

не стоит мутировать action, расскажу при разборе домашки почему

export default (products = defaultUsers, action) => {
const { type } = action;

switch (type) {
Copy link
Owner

Choose a reason for hiding this comment

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

пропущено добавление нового юзера из ревью

<div className={styles.rate}>
<Rate value={rating} />
function Review({review, users}) {
const user = users[review?.userId] ? users[review?.userId] : null;
Copy link
Owner

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