'it runs with no errors but console says nothing, as you see there im using CDN
console says nothing, its running with 0 errors but it shows nothing. I want it to show a clock, im just reviewing react, thats a react example from documentation, maybe you ask me why i use react like that and i dont just download it, thats because cmd says I have a problem related to network conectivity. Im using my neighbor's wifi, so... as i said console doesnt show i problem but it doesnt work as i want, it just show "hello" and i want a clock.
Html:
<!DOCTYPE html>
<html lang="es">
<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 app</title>
</head>
<body>
<div id="root">hola</div>
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
<script type="text/jsx" src="app.jsx"></script>
</body>
</html>
JSX:
const root = ReactDOM.createRoot(document.getElementById('root'));
function Clock(props){
return (
<div>
<h1>Hola</h1>
<h2>It is {props.date.toLocaleTimeString()}</h2>
</div>
)
}
let element = <h1>hola pendejo</h1>
function tick(){
root.render(<Clock date={new Date()} />)
}
root.render(element)
setInterval(tick,1000)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
