0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

React の使い方 (その2)

Last updated at Posted at 2022-05-12

こちらのページを参考にしました。
Displaying Data with Props

index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
</head>
<body>
Hello World!<br />
<div id="app"></div>
<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>
<script type="text/jsx">
const app = document.getElementById('app')
function Header(props) {
	console.log(props.title)
     return <h1>{props.title}</h1>
   }
function HomePage() {
	const names = ['夏目漱石', '島崎藤村', '森鴎外']
  return (
	<div>
	<Header title="こんにちは" />
<ul>
        {names.map((name) => (
          <li key={name}>{name}</li>
        ))}
      </ul>
	</div>
	)
}
const root = ReactDOM.createRoot(app)
root.render(<HomePage />)
</script>
May/12/2022 AM 10:05<br />
</body>
</html>

ブラウザーでアクセスした結果
react_may11_03.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?