Created
January 10, 2023 13:23
-
-
Save jabed-web-dev/f87677228c12a9389c342b3cfe5997a3 to your computer and use it in GitHub Desktop.
Revisions
-
jabed-web-dev created this gist
Jan 10, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ import { useState } from 'react' export default function ReactApp() { const [count, setCount] = useState(0) function handleClick() { setCount(count + 1) } return <button onClick={handleClick}>Clicked {`${count}`} times</button> } ;(function MyApp () { const root = document.getElementById('my-root') const button = document.createElement('button') let count = 0 button.addEventListener('click', () => { count += 1 button.childNodes[1].data = count }) button.append('Clicked ', count, ' times') root.appendChild(button) })()