[英]Converting a .jsx file using Tailwindcss Typescript error
I copy an example code from the Tailwind sight.我从 Tailwind 视线中复制了一个示例代码。 When I changed the file to a.tsx I get an error with the className.
当我将文件更改为 a.tsx 时,类名出现错误。
Do I need to define a type我需要定义一个类型吗
What do I need to do to make the error go away?我需要做什么才能消除错误 go?
Binding element 'className' implicitly has an 'any' type.绑定元素“className”隐式具有“any”类型。
import clsx from 'clsx'
export function Container({ className, ...props }) {
return (
<div
className={clsx('mx-auto max-w-7xl px-4 sm:px-6 lg:px-8', className)}
{...props}
/>
)
}
import clsx from 'clsx'
interface ContainerProps {
className: string
}
export function Container({ className, ...props }: ContainerProps) {
return <div className={clsx('mx-auto max-w-7xl px-4 sm:px-6 lg:px-8', className)} {...props} />
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.