i got an error using styled component and eslint,
i want to use styled component in a separete files and i got an error
JavaScript
x
2
1
styledHeader' is defined but never used.
2
this is the whole component
JavaScript
1
13
13
1
import { styledHeader } from "./header.styled";
2
3
/**
4
* return a JSX Element Header
5
* @return {JSX.Element} <Header/>
6
*/
7
function Header() {
8
return <styledHeader>
9
</styledHeader>;
10
}
11
12
export default Header;
13
Advertisement
Answer
React component names must start with a capital letter.
It isn’t used because you haven’t used it as a valid component.
JavaScript
1
6
1
import { styledHeader as StyledHeader } from "./header.styled";
2
3
function Header() {
4
return <StyledHeader></StyledHeader>;
5
}
6