From 8ca5575ac54c7a8fe4857e646bc368bd62cff358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Mungu=C3=ADa?= Date: Tue, 30 Jan 2018 23:30:56 -0800 Subject: [PATCH] fix(challenges): Add key prop to root element (#16493) The key prop was added to solve the issue of the first question being added to subsequent questions Closes #16483 --- common/app/routes/Challenges/views/quiz/Quiz.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/app/routes/Challenges/views/quiz/Quiz.jsx b/common/app/routes/Challenges/views/quiz/Quiz.jsx index 6fbca50d6fb..8638e319dfa 100644 --- a/common/app/routes/Challenges/views/quiz/Quiz.jsx +++ b/common/app/routes/Challenges/views/quiz/Quiz.jsx @@ -29,13 +29,15 @@ const mapStateToProps = createSelector( ( { description = [], - title + title, + dashedName }, meta, currentIndex, selectedChoice, correct ) => ({ + dashedName, title, description, meta, @@ -59,6 +61,7 @@ function mapDispatchToProps(dispatch) { const propTypes = { correct: PropTypes.number, currentIndex: PropTypes.number, + dashedName: PropTypes.string, description: PropTypes.string, meta: PropTypes.object, nextQuestion: PropTypes.fun, @@ -139,8 +142,9 @@ export class QuizChallenge extends PureComponent { renderQuiz() { const currentIndex = this.props.currentIndex; const question = this.props.description[currentIndex]; + const questionKey = this.props.dashedName + currentIndex.toString(); return ( -
+
{this.renderTitle()}