-
Notifications
You must be signed in to change notification settings - Fork 0
Task 1 react components #1
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
base: main
Are you sure you want to change the base?
Conversation
anutaguzova
commented
Aug 31, 2021
- Task - https://github.com/rolling-scopes-school/tasks/blob/master/tasks/react/react-components.md
- Deploy https://task-1-react-components.netlify.app/

- задание выполнено: - сборка; - компоненты Card и Search bar
src/App.tsx
Outdated
| map: 'https://goo.gl/maps/abDoKFxqoc66ptWt5', | ||
| like: '850', | ||
| eye: '950', | ||
| }, |
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.
Необходимо вынести данные для карточек в отдельный файл, такие данные не хранятся в state
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.
исправлено
src/App.tsx
Outdated
| <Search /> | ||
| <div className="card-container"> | ||
| {this.state.card.map((card) => { | ||
| return <Card card={card} key={card.country + Math.random()} />; |
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.
Молодец что добавила key={card.country + Math.random()}, тем самым ты избавилась от ошибки в консоли. Но использование Math.random() плохая практика. Можно было добавить id к карточкам, но так тоже можно.
src/components/card.tsx
Outdated
| @@ -0,0 +1,35 @@ | |||
| export function Card(props) { | |||
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.
Стоит использовать деструктуризацию для props:
export function Card({card})
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.
исправила
| "main": "index.js", | ||
| "scripts": { | ||
| "start": "webpack serve --config webpack/webpack.config.js --env env=dev", | ||
| "build": "webpack --config webpack/webpack.config.js --env env=prod", |
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.
Есть скрипт для prod сборки, но нет скрипта для dev сборки
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.
добавила