Skip to content

WIP не получается до конца разрбраться с типами для useData#7

Open
aincube wants to merge 1 commit intomasterfrom
homework-7
Open

WIP не получается до конца разрбраться с типами для useData#7
aincube wants to merge 1 commit intomasterfrom
homework-7

Conversation

@aincube
Copy link
Copy Markdown
Owner

@aincube aincube commented Nov 18, 2020

Пока пробовал разные способы из головы и чата - в конец запутался как нормально типизровать. Но, думаю, за вечер разберусь

@aincube aincube requested a review from ZarMarathon November 18, 2020 18:54
Copy link
Copy Markdown
Collaborator

@ZarMarathon ZarMarathon left a comment

Choose a reason for hiding this comment

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

аппрув

}

const useData = <T>(endpoint: string, query: object, deps: any[] = []): IuseData<T> => {
const [data, setData] = useState<T>(null);
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.

const [data, setData] = useState<T | null>(null);

import req from '../utils/request';

interface IuseData<T> {
data: T;
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.

data: T | null;
а так в остальном все норм типизировано
только u в IUseData заглавной стоит написать)

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