代码拉取完成,页面将自动刷新
<!doctype html>
<title>15 Simple Integration - React From Zero</title>
<script src="https://unpkg.com/react@16.4.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.4.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://unpkg.com/moment@2.18.1/min/moment.min.js">
// Most of the time we have to use third party libraries
// in our applications. Here we integrate a simple one
// for date handling and use it with React. It doesn"t
// use the DOM so it can be integrated fairly easy.
</script>
<div id="app"></div>
<script type="text/babel">
// Simple libraries that are called synchronous can used
// directly in JSX with the help of {}, since they are
// just function calls
var DateToday = function() {
return <span>{moment().format("DD.MM.YYYY")}</span>
}
var tomorrow = moment().add(1, "day")
// Nothing exciting happening here, just calling the library
// and displaying its return values. First with some
// elements, then used inside of a component.
var reactElement =
<div>
<h1 style={{textAlign:"center"}}>
Tomorrow is {tomorrow.format("MMMM")} the {tomorrow.format("Do")}
</h1>
<DateToday/>
</div>
ReactDOM.render(reactElement, document.getElementById("app"))
</script>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。