Skip to content

Instantly share code, notes, and snippets.

@jeonghwan-kim
Created May 21, 2022 08:34
Show Gist options
  • Save jeonghwan-kim/cc9e0763091f0aacd896188cac2a0c60 to your computer and use it in GitHub Desktop.
Save jeonghwan-kim/cc9e0763091f0aacd896188cac2a0c60 to your computer and use it in GitHub Desktop.
react strict mode
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React strict mode test</title>
</head>
<body>
<div id="app"></div>
<!-- <script
crossorigin
src="https://unpkg.com/react@18/umd/react.development.js"
></script> -->
<script
crossorigin
src="https://unpkg.com/react@18/umd/react.production.min.js"
></script>
<!-- <script
crossorigin
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
></script> -->
<script
crossorigin
src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script
type="text/babel"
data-presets="react"
data-type="module"
src="./main.js"
></script>
</body>
</html>
let count = 0;
const App = () => {
console.log(count++); // 0, 1
return <div>App</div>;
};
const root = ReactDOM.createRoot(document.querySelector("#app"));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
@jeonghwan-kim
Copy link
Author

@jeonghwan-kim
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment