Skip to content

Commit

Permalink
remove duplicate from HocBadges
Browse files Browse the repository at this point in the history
  • Loading branch information
bl00mber committed May 9, 2020
1 parent 6a830d3 commit dc1c955
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*/

import * as React from 'react';
import {
ElementTypeForwardRef,
ElementTypeMemo,
} from 'react-devtools-shared/src/types';
import styles from './HocBadges.css';

import type {Element} from './types';
Expand All @@ -21,22 +17,14 @@ type Props = {|
|};

export default function HocBadges({element}: Props) {
const {hocDisplayNames, type} = ((element: any): Element);
const {hocDisplayNames} = ((element: any): Element);

let typeBadge = null;
if (type === ElementTypeMemo) {
typeBadge = 'Memo';
} else if (type === ElementTypeForwardRef) {
typeBadge = 'ForwardRef';
}

if (hocDisplayNames === null && typeBadge === null) {
if (hocDisplayNames === null) {
return null;
}

return (
<div className={styles.HocBadges}>
{typeBadge !== null && <div className={styles.Badge}>{typeBadge}</div>}
{hocDisplayNames !== null &&
hocDisplayNames.map(hocDisplayName => (
<div key={hocDisplayName} className={styles.Badge}>
Expand Down

0 comments on commit dc1c955

Please sign in to comment.