I need a displayName
property for a React component. If not, React DevTools shows Anonymous
. I attempted a separate line for export
and const Titlebar = function(props){...}
, no luck. Can DevTools read the function name directly without displayName
?
export function Titlebar (props: TitlebarProps): React.ReactElement {
return (
<h1 className={styles.titlebar}>
<a href='/'>{props.title}</a>
</h1>
)
}
Titlebar.displayName = 'Titlebar'