<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="
viewport" content="width=device-width, initial-scale=1.0"> <title>Document</
title> </head> <body> <div id="root"></div> <script src="../lib/react.js"></
script> <script src="../lib/react-dom.js"></script> <script src="../lib/babel.js
"></script> <script type="text/babel"> let message = "Hello World" function
btnClick(){ message = "Hello React" rootRender() } const root = ReactDOM.
createRoot(document.querySelector("#root")) function rootRender() { root.render(
( <div> <h2>{message}</h2> <button onClick={btnClick}>修改文本</button> </div> )) }
rootRender() </script> </body> </html>

技术
今日推荐
阅读数 169811
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信