Reputation: 311
There is jsx element, all I need is remove 'href' attribute based on a value,
code below throws parsing error,
<a
className={`nav-link ${item === active ? 'active' : ''}`}
data-mdb-toggle="tab"
{...{item.focus ? `href == '#active_tab'`}} // Parsing error: Unexpected token, expected "," role="tab"
aria-selected={item.name === active}
>
how to fix it?
Upvotes: 1
Views: 207
Reputation: 2968
your condition is not correct. change to below:
{... item.focus ? {href: '#active_tab'} : {}}
Upvotes: 2