index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My React App</title>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<link rel="stylesheet" href="style.css">
<body>
<div id="container"></div>
<script type="text/babel">
'use strict';
{
const container = document.querySelector('#container');
const root = ReactDOM.createRoot(container);
root.render(
<>
<h1>アイテム</h1>
<ul>
<li>ポーション</li>
<li>エリクサー</li>
<li>ラストエリクサー</li>
</ul>
<p>合計: 0G</p>
</>
);
}
</script>
</body>
</html>
style.css
@charset "utf-8";
body{
margin: 0;
}
#container{
width: 400px;
margin: auto;
background: pink;
}
h1{
margin: 0;
font-size: 20px;
text-align: center;
}
ul{
margin: 0;
padding: 0;
list-style-type: none;
}
p{
margin: 0;
text-align: right;
}