import React, { useState } from 'react'; import styles from './index.less'; import classNames from 'classNames'; const Index = ({ isShowAnswer, isRight,id, no, title,isSelected=false,onSelect }) => { return ( <> <div className={classNames( styles.option, isShowAnswer && (isRight ? styles.right : styles.error), isSelected && styles.selected, )} onClick={()=>onSelect(id,!isSelected)} > {no}.{title} {isShowAnswer && <img src={`/images/${isRight ? 'right' : 'error'}.png`} alt=""/>} </div> </> ); }; export default Index;