我正在尝试创建一个小程序,我必须在其中使用 react JS 显示日期和时间。它按预期显示 HTML 页面中除日期和时间值之外的所有内容。
enter code here
import React from "react";
import ReactDOM from "react-dom";
const name = "Flash";
const currDate = new Date().toLocaleDateString;
const currTime = new Date().toLocaleTimeString;
ReactDOM.render(
<>
<h1>My name is {name}</h1>
<p> Current Date is = {currDate} </p>
<p> Curremt Time is = {currTime} </p>
</>,
document.getElementById("root"));