import React from "react"; import { IQuestionData } from "../types"; type Props = { question: IQuestionData; }; export const RDropdown = ({ question }: Props) => { const result = question.answers.reduce((acc: any, cur: any) => { acc[cur] = (acc[cur] || 0) + 1; return acc; }, {}); return (
{question.content.choices.map((choice: any, index: number) => (
{choice.text} - {result[choice.text] ? result[choice.text] : 0}
))}
); };