Unexpected string concatenation.
18 </svg>
19 </button>
20
21 <div id="dropdown" className={dropdownStyles.dropdown} active={"" + dropdownActive} style={{ position: "absolute", top: "3.5rem" }}>22 <ul aria-labelledby="dropdownMenu">
23 <Link href="/download">
24 <a className={styles["nav-link"]}>Download</a>
Unexpected string concatenation.
13 <nav className={styles.nav}>
14 <span></span>
15 <button id="dropdownMenu" data-dropdown-toggle="dropdown" type="button" className={dropdownStyles.dropdownToggle} onClick={dropdownClick}>
16 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth="1.5" stroke="currentColor" aria-hidden="true" className="w-8" active={"" + dropdownActive}>17 <path strokeLinecap="round" strokeLinejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
18 </svg>
19 </button>
Description
In ES2015 (ES6), we can use template literals instead of string concatenation.
var str = `Hello, ${name}!`;
Bad Practice
var str = "Hello, " + name + "!";
var str = "Time: " + (12 * 60 * 60 * 1000);
Recommended
var str = "Hello World!";
var str = `Hello, ${name}!`;
var str = `Time: ${12 * 60 * 60 * 1000}`;
var str = "Hello, " + "World!";