How to use momentJS in react?

I’m building my first Notes App in React and have run into a wall. I’ve tried installing MomentJS via npm but not sure how to use it in my component. I’ve stored my dates in an object using new Date().getTime() and now I want to be able to format this timestamp properly but keep getting error:

TypeError: Cannot call a class as a function

my code is below:

import React, { Fragment } from 'react';
import classes from './Note.module.css'
import moment from 'react-moment'



const note = (props) => {
    
    return (
        <Fragment>
        <div className = {classes.Note}>
           
            <h1 onClick = {props.click} >{props.title}</h1>


            <p></p>
            
            Created: {moment(new Date(props.createdAt)).format("YYYY-MM-DD hh:mm:ss")
}
            
            <p></p>
            
            <button className = {classes.Delete} onClick = {props.del}>Delete</button>

        </div>
    </Fragment>
    )
}


export default note

react-moment exports React component, but you’re using it like regular moment.

react-moment: https://www.npmjs.com/package/react-moment
moment: http://momentjs.com/docs/

so i can just npm install moment in node and then import moment into the component i want to use it in and just use it like i usually do?

Yes, just like you would use any other JavaScript library. And maybe look into date-fns instead of moment: https://www.npmjs.com/package/date-fns

Is there anything else like moment.js to use for list or tables,etc