備忘録
codesandboxでは最新版のひな形がデフォルトで使用されるため、ver1.7.0.2用を用意する
index.js
index.js
import React from "react";
import ReactDOM from "react-dom";
import { App } from "./App";
ReactDOM.render(<App />, document.getElementById("root"));
App.js
App.js
import React, { useState } from "react";
export const App = () => {
//Hooks
const [todoText, setTodoText] = useState("");
return (
<>
// ソースコード記載
</>
);
};
index.html
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
</body>
</html>