Р
Size: a a a
Р
SB
getInstance() { return this._instance || (this._instance = this.create())}js : { inited } записываешь в статическое свойство ссылку this.__self._instance = this есть различные кейсы как сделатьEW
V
EW
src
├── App.tsx
├── features
│ ├── notifications
│ │ ├── api.ts
│ │ ├── components
│ │ │ ├── GroupForm
│ │ │ │ ├── GroupForm.const.ts
│ │ │ │ ├── GroupForm.tsx
│ │ │ │ ├── GroupForm.validator.ts
│ │ │ │ └── index.ts
│ │ ├── index.ts
│ │ └── types.ts
├── index.css
├── index.tsx
├── lib
│ ├── history.ts
├── routes.tsx
├── pages
│ ├── home
│ │ ├── HomePage.model.ts
│ │ ├── HomePage.tsx
│ │ └── index.ts
└── ui
├── components
│ ├── Button
│ │ ├── Button.css
│ │ └── Button.tsx
│ └── index.ts
└── templates
├── Content
│ ├── Content.css
│ └── Content.tsx
└── index.ts
EW
Button@desktop.tsxEW
pages/home — /, pages/services/create — /services/createMK
A
src
├── App.tsx
├── features
│ ├── notifications
│ │ ├── api.ts
│ │ ├── components
│ │ │ ├── GroupForm
│ │ │ │ ├── GroupForm.const.ts
│ │ │ │ ├── GroupForm.tsx
│ │ │ │ ├── GroupForm.validator.ts
│ │ │ │ └── index.ts
│ │ ├── index.ts
│ │ └── types.ts
├── index.css
├── index.tsx
├── lib
│ ├── history.ts
├── routes.tsx
├── pages
│ ├── home
│ │ ├── HomePage.model.ts
│ │ ├── HomePage.tsx
│ │ └── index.ts
└── ui
├── components
│ ├── Button
│ │ ├── Button.css
│ │ └── Button.tsx
│ └── index.ts
└── templates
├── Content
│ ├── Content.css
│ └── Content.tsx
└── index.ts
V
src
├── App.tsx
├── features
│ ├── notifications
│ │ ├── api.ts
│ │ ├── components
│ │ │ ├── GroupForm
│ │ │ │ ├── GroupForm.const.ts
│ │ │ │ ├── GroupForm.tsx
│ │ │ │ ├── GroupForm.validator.ts
│ │ │ │ └── index.ts
│ │ ├── index.ts
│ │ └── types.ts
├── index.css
├── index.tsx
├── lib
│ ├── history.ts
├── routes.tsx
├── pages
│ ├── home
│ │ ├── HomePage.model.ts
│ │ ├── HomePage.tsx
│ │ └── index.ts
└── ui
├── components
│ ├── Button
│ │ ├── Button.css
│ │ └── Button.tsx
│ └── index.ts
└── templates
├── Content
│ ├── Content.css
│ └── Content.tsx
└── index.ts
src/features/notifications/components, pages/home/homePage что то до меня не все доходитEW
import React, { FC, useEffect } from 'react';
import { useStore } from 'effector-react';
import { useMatch } from 'lib/react-router-hooks';
import { ContentTemplate } from 'ui/templates';
import { Loader, Box, RouterLink, Heading, List, RouterButton } from 'ui/components';
import { $services, pageMounted } from './HomePage.model';
export const HomePage: FC = () => {
const { url } = useMatch();
const { status, list } = useStore($services);
useEffect(() => {
pageMounted();
}, [url]);
return (
<ContentTemplate>
<Box>
<Heading level={1}>Список сервисов</Heading>
<RouterButton to="/service/create" theme="normal" size="n" view="default" tone="default">
Добавить новый сервис
</RouterButton>
</Box>
<Box>
<Loader fetching={status === 'loading'}>
<List
items={list.map(({ id }) => (
<RouterLink theme="normal" to={`/service/${id}`}>
{id}
</RouterLink>
))}
/>
</Loader>
</Box>
</ContentTemplate>
);
};EW
src/features/notifications/components компоненты свойственные только для фичи нотификаций, т.к. их нигде нельзя больше реиспользовать, поэтому они там, как только такая необходимость появится (реиспользование), можно будет вынести в ui/components, либо использовать из фичиAY
EW
V
import React, { FC, useEffect } from 'react';
import { useStore } from 'effector-react';
import { useMatch } from 'lib/react-router-hooks';
import { ContentTemplate } from 'ui/templates';
import { Loader, Box, RouterLink, Heading, List, RouterButton } from 'ui/components';
import { $services, pageMounted } from './HomePage.model';
export const HomePage: FC = () => {
const { url } = useMatch();
const { status, list } = useStore($services);
useEffect(() => {
pageMounted();
}, [url]);
return (
<ContentTemplate>
<Box>
<Heading level={1}>Список сервисов</Heading>
<RouterButton to="/service/create" theme="normal" size="n" view="default" tone="default">
Добавить новый сервис
</RouterButton>
</Box>
<Box>
<Loader fetching={status === 'loading'}>
<List
items={list.map(({ id }) => (
<RouterLink theme="normal" to={`/service/${id}`}>
{id}
</RouterLink>
))}
/>
</Loader>
</Box>
</ContentTemplate>
);
};AP