could you help me?
When i try import tag "isPast" of data-fns to react.tsx, show that message: import isPast Module '"data-fns"' has no exported member 'isPast'.ts(2305) or 'isPast' is declared but its value is never read.
So, i don't know what i do! Im begginer...
import { CheckCircle, Lock } from 'phosphor-react'
import {isPast} from 'data-fns' //The error is over here!
interface LessonProps {
title: string;
slug: string;
availableAt: Date;
type: 'Live' | 'class';
}
export function Lesson(props: LessonProps) {
const isLessonAvailable = isPast(props.availableAt);
return(
<a href="#">
<span className="text-gray-300">
{props.availableAt.toString()}
</span>
<div className="rounded border border-gray-500 margin top-2 p-4">
<header className="flex items-center justify-between">
{isLessonAvailable?(
<span className="text-sn text-blue-500 font-medium flex items-center gap-2">
<CheckCircle size={20}/>
Conteúdo liberado
</span>
) : (
<span className="text-sn text-orange-500 font-medium flex items-center gap-2">
<Lock size={20}/>
Em breve
</span>
)}
<span className="text-xs rounded py-[0.125rem] px-2 text-white font bold border border-green-300">
{props.type == 'Live' ? 'AO VIVO' : 'AULA PRATICA'}
</span>
</header>
<strong className="text-gray-200 mt-5 block">
{props.title}
</strong>
</div>
</a>
)
}
You have a typo. It is date-fns. Make sure you have it installed as well
npm i date-fns
Last advice: get a good linter, cause it would complain that there no such a module as data-fns