0

I have the following .tsx component:

const Header = ({ dict: map, lang: string }) => { return ( <header className="flex items-center justify-between py-10"> <div> <Link href={`/${lang}`} aria-label={siteMetadata.headerTitle}> <div className="flex items-center justify-between"> ... 

yarn build is giving the following error when linting: Type error: Cannot find name 'lang' referring to the href in the Link component. Why is this the case, when I have already passed in lang in the prop to the component?

1 Answer 1

1

Is your define error?

const Header = ({ dict: map, lang: string }) => {

I think it should be

const Header = ({dict, lang}: { dict: Map, lang: string }) => { 
Sign up to request clarification or add additional context in comments.

2 Comments

Doing this gives a different error: ``` Type error: Cannot find name 'map'. Did you mean 'Map'? ```
yeah, Map is right

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.