Skip to content

Начинаем программировать#2

Merged
keksobot merged 4 commits into
htmlacademy-react:masterfrom
Igor-Alexeevich:module2-task1
May 25, 2026
Merged

Начинаем программировать#2
keksobot merged 4 commits into
htmlacademy-react:masterfrom
Igor-Alexeevich:module2-task1

Conversation

@Igor-Alexeevich
Copy link
Copy Markdown
Contributor

@Igor-Alexeevich Igor-Alexeevich commented May 23, 2026

offersCount: number;
}

function App({ offersCount }: AppScreenProps): JSX.Element {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

JSX.Element - не обязательно

Copy link
Copy Markdown
Collaborator

@UnidentifiedRaccoon UnidentifiedRaccoon May 23, 2026

Choose a reason for hiding this comment

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

src/components/app/app.tsx

upd - правильней src/app/app.tsx, потому что app это не переиспользуемый компонент, а отдельная смысловая сущность

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не исправлено:
Должно быть src/app/app.tsx

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

offer-card.tsx

Comment thread src/components/card/card.tsx Outdated
@@ -0,0 +1,42 @@


function Card(): JSX.Element {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

OfferCard()

Comment thread src/pages/favorites/favorites-page.tsx Outdated
@@ -0,0 +1,171 @@
function LoginPage(): JSX.Element {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FavoritesPage

<li className="places__option" tabIndex={0}>Top rated first</li>
</ul>
</form>
<div className="cities__places-list places__list tabs__content">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[...new Array(offersCount)].map((offer) => <Card />)

Почему такая запись лучше
offersCount в дальнейшем сменится offers у которыйх тип Array<Offer>

offers.map((offer) => <Card offer={offer} />)

Comment thread src/index.tsx
@@ -1,12 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './components/app/app';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Надо дирректорию для App объявить с маленькой буквы

Переместить в корень src
И тогда путь будет "./app/app"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не исправлено:
Переместить в корень src
И тогда путь будет "./app/app"

Comment thread src/index.tsx Outdated
import App from './components/app/app';

const Setting = {
offersCount: 312,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Это предупреждение связано с правилом react-refresh/only-export-components: константа Setting названа с заглавной буквы, из-за чего линтер принимает её за компонент.

Можно на него забить - потом будет отдельный файл с константами

@keksobot keksobot changed the title Module2 task1 Начинаем программировать May 24, 2026
@keksobot keksobot merged commit 34ea7df into htmlacademy-react:master May 25, 2026
1 of 2 checks passed
Comment thread src/index.tsx
@@ -1,12 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './components/app/app';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не исправлено:
Переместить в корень src
И тогда путь будет "./app/app"

Comment thread src/const.ts
@@ -0,0 +1,5 @@
const setting = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Новая ошибка:

Константные объекты с большой буквы (смотри критерий Б9)
https://up.htmlacademy.ru/react-individual/3/criteries#b9

Comment thread src/const.ts
offersCount: 312,
} as const;

export default setting;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Новая ошибка:

В данном случае как default не экспортируем

Про то как устроены экспорты и какие когда используются, можно почитать тут: https://learn.javascript.ru/import-export

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не исправлено:
Должно быть src/app/app.tsx

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.

3 participants