Skip to content

Commit

Permalink
Merge pull request #193 from 18F/key-error
Browse files Browse the repository at this point in the history
Account for multiple texts with the same key.
  • Loading branch information
cmc333333 authored Apr 3, 2017
2 parents 1b32e0b + 5ae81cc commit 8fb82fb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ui/components/requirements/requirement.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react';

export default function Requirement({ requirement }) {
// We could have multiple lines with the same text, so can't use a stable ID
/* eslint-disable react/no-array-index-key */
const reqTexts = requirement.req_text.split('\n').map((line, idx) => (
<span key={idx} className="req-text-line mb1">{ line }<br /></span>
));
/* eslint-enable react/no-array-index-key */
return (
<div className="req p2 clearfix max-width-3">
<div className="req-id col col-1 mb2 mr1">
{requirement.req_id}
</div>
<div className="req-text col col-10">
{ requirement.req_text.split('\n').map(line => (
<span key={line} className="req-text-line mb1">{ line }<br /></span>
))}
{ reqTexts }
<div className="clearfix mt3">
<div className="applies-to mr2">
Applies to: [not implemented]
Expand Down

0 comments on commit 8fb82fb

Please sign in to comment.