使用React实现一个简洁的单页面功能

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>React Input Display</title>
</head>
<body>
<div id="root"></div>

<script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone@7.25.9/babel.min.js"></script>

<script type="text/babel">
    function App() {
        const [text, setText] = React.useState("");

        const handleChange = (event) => {
            setText(event.target.value);
        };

        return (
            <div style={{ textAlign: "center", marginTop: "50px" }}>
                <h1>Text Display</h1>
                <label>aa
                    <input type="text" value={text} onChange={handleChange} />
                </label>
                <p>{text}</p>
            </div>
        );
    }

    ReactDOM.render(<App />, document.getElementById("root"));
</script>
</body>
</html>
相关推荐
子兮曰6 小时前
OpenClaw入门:从零开始搭建你的私有化AI助手
前端·架构·github
吴仰晖6 小时前
使用github copliot chat的源码学习之Chromium Compositor
前端
1024小神6 小时前
github发布pages的几种状态记录
前端
不像程序员的程序媛8 小时前
Nginx日志切分
服务器·前端·nginx
Daniel李华8 小时前
echarts使用案例
android·javascript·echarts
北原_春希8 小时前
如何在Vue3项目中引入并使用Echarts图表
前端·javascript·echarts
JY-HPS8 小时前
echarts天气折线图
javascript·vue.js·echarts
尽意啊8 小时前
echarts树图动态添加子节点
前端·javascript·echarts
吃面必吃蒜8 小时前
echarts 极坐标柱状图 如何定义柱子颜色
前端·javascript·echarts
O_oStayPositive8 小时前
Vue3使用ECharts
前端·javascript·echarts