-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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} /> |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут лучше не весь BasketItem вместе с кнопками оборачивать в Link, а только имя продукта
No description provided.