我尝试在JSX中使用花括号内的h1
呈现包含当前日期的h2
和new Date()
,但它并未显示任何内容
这是我的代码:
function tick() {
const APP = (
<div>
<h1>Hello, World!</h1>
<h2>It is {new Date()}.</h2>
</div>
);
ReactDOM.render(APP,document.getElementById('root'))
}
tick();
&#13;
<script src="//unpkg.com/react/umd/react.development.js"></script>
<script src="//unpkg.com/react-dom/umd/react-dom.development.js"></script>
<div id="root"></div>
&#13;
答案 0 :(得分:1)
Date是一个JavaScript对象。如果您希望它工作,您需要采用不同的格式,如字符串
select a.defendantid, count(distinct(ac.arrestid)) as count
FROM `arrest` AS a LEFT JOIN `arrestcharges` AS ac
ON a.id=ac.arrestid LEFT JOIN `dispositions` AS d
ON ac.dispositionid=d.id
WHERE d.dispocategory=0 AND ac.grade="M1"
GROUP BY a.defendantid HAVING count>1;
但是,我建议您使用所有JS日期需求。
值得一提的是function tick() {
const APP = (
<div>
<h1>Hello, World!</h1>
<h2>It is {(new Date()).toLocaleString()}.</h2>
</div>
);
ReactDOM.render(APP,document.getElementById('root'))
}
tick();
是React组件的完美候选者。尝试将其制作成功能或基于类的组件
APP
答案 1 :(得分:0)
将新日期作为对象
function tick() {
const APP = (
<div>
<h1>Hello, World!</h1>
<h2>It is {new Date().toString()}.</h2>
</div>
);
ReactDOM.render(APP,document.getElementById('root'))
}
tick();
答案 2 :(得分:0)
如果打开控制台,您应该会看到一个相当描述性的错误:
JFrame mainFrame = Forms.mainFrameDraw(new Chat());
JFrame enterFrame = Forms.enterFrameDraw(new Chat());