type formattedString = string; @react.component let make = () => { let (date: MomentRe.Moment.t, updateDate) = React.useState(MomentRe.momentNow); let formatDate: MomentRe.Moment.t => formattedString = (date: MomentRe.Moment.t) => { date |> MomentRe.Moment.format("YYYY-MM-DD"); }; let handleChange = (event: ReactEvent.Form.t) => { let value: formattedString = ReactEvent.Form.target(event)["value"]; updateDate(_ => {value->MomentRe.momentWithFormat("YYYY-MM-DD")}); }; <> ; };