Created
May 21, 2022 08:34
-
-
Save jeonghwan-kim/cc9e0763091f0aacd896188cac2a0c60 to your computer and use it in GitHub Desktop.
react strict mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
발행한 글: https://jeonghwan-kim.github.io/2022/05/20/react-strict-mode