December 2019
Intermediate to advanced
598 pages
12h 21m
English
Let's carry out the following steps to implement a submission on the answer form:
export interface PostAnswerData { questionId: number; content: string; userName: string; created: Date;}export const postAnswer = async ( answer: PostAnswerData,): Promise<AnswerData | undefined> => { await wait(500); const question = questions.filter( q => q.questionId === answer.questionId, )[0]; const answerInQuestion: AnswerData = { answerId: 99, ...answer, }; question.answers.push(answerInQuestion); return answerInQuestion;};
The function finds the question in the questions array and adds the answer to it. The remainder of the preceding ...
Read now
Unlock full access