react-moment error Moment
It worked on the old computer, but now I can’t understand what the problem is, I even changed the version of React
now crashes with a syntax error
marks Moment as an error
my code
import React from 'react';
import Moment from 'react-moment';
interface DateMomentProps {
date: string;
column?: boolean;
}
const DateMoment: React.FC<DateMomentProps> = ({ date, column = false }) => {
return (
<>
{column ? (
<div style={{ display: 'flex', flexDirection: 'column' }}>
<Moment format="YYYY.MM.DD, ">{date}</Moment>
<Moment format="hh:mm A">{date}</Moment>
</div>
) : (
<Moment format="YYYY.MM.DD, hh:mm A">{date}</Moment>
)}
</>
);
};
export default DateMoment;
VS code error JSX element type 'Moment' is not a constructor function for JSX elements. TS2605
12 | {column ? (
13 | <div style={{ display: 'flex', flexDirection: 'column' }}>
> 14 | <Moment format="YYYY.MM.DD, ">{date}</Moment>
| ^
15 | <Moment format="hh:mm A">{date}</Moment>
16 | </div>
17 | ) : (