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

add routes and links to basket item HT6 #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kseniiaFeodorova
Copy link

No description provided.

@@ -10,7 +10,7 @@ export default class App extends PureComponent {
<div>
<Header />
<Switch>
<Route path="/" exact component={() => <h2>Home page</h2>} />
<Route path="/" exact component={Restaurants} />
Copy link
Owner

Choose a reason for hiding this comment

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

тут должен быть Redirect, а не Route

@@ -22,7 +25,7 @@ export default (state = initialState, action) =>
draft.loading[restId] = false;
draft.loaded[restId] = true;
draft.error = null;
Object.assign(draft.entities, arrToMap(data));
Object.assign(draft.entities, arrToMap(dataWithRestId));
Copy link
Owner

Choose a reason for hiding this comment

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

Из данных, которые у нас лежат в редьюсере ресторанов мы можем однозначно сказать какой продукт из какого ресторана. Теперь эта информация у нас есть в двух местах, тут и в ресторанах. Так делать не стоит.

<Switch>
<Route path="/restaurants/:restId/:activeTab">
{({ match }) => {
switch (match.params.activeTab) {
Copy link
Owner

Choose a reason for hiding this comment

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

проще сделать несколько Route, покажу на своей домашке

key={product.id}
subtotal={subtotal}
/>
<Link to={`/restaurants/${product.restId}`} key={product.id}>
Copy link
Owner

@koretskiyav koretskiyav Nov 2, 2021

Choose a reason for hiding this comment

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

тут лучше не весь BasketItem вместе с кнопками оборачивать в Link, а только имя продукта

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