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
pull/16616/head
Iván Munguía 2018-01-30 23:30:56 -08:00 committed by Stuart Taylor
parent 7e0f3581bf
commit 8ca5575ac5
1 changed files with 6 additions and 2 deletions

View File

@ -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 (
<div>
<div key={questionKey} >
{this.renderTitle()}
<Row>
<Col md={6}>