Skip to content

Commit

Permalink
fix: Updated code to avoid mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
rijuma committed Oct 25, 2023
1 parent 382f101 commit 6852d4b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/course-home/courseware-search/CoursewareSearchResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ const CoursewareSearchResults = ({ intl, results }) => {
const key = type.toLowerCase();
const icon = iconTypeMapping[key] || defaultIcon;

const linkProps = { href };

if (isExternal) {
linkProps.target = '_blank';
linkProps.rel = 'nofollow';
}
const linkProps = isExternal ? {
href,
target: '_blank',
rel: 'nofollow',
} : { href };

return (
<a className="courseware-search-results__item" {...linkProps}>
Expand Down

0 comments on commit 6852d4b

Please sign in to comment.