There was an error while loading. Please reload this page.
1 parent b8c5bd4 commit 04d8498Copy full SHA for 04d8498
solutions/live-paragraph.jsx
@@ -0,0 +1,19 @@
1
+import React, { useState } from "react"
2
+import { createRoot } from "react-dom/client"
3
+
4
+function LiveText() {
5
+ const [text, setText] = useState("")
6
7
+ const onChange = ({ target: { value } }) => {
8
+ setText(value)
9
+ }
10
+ return (
11
+ <>
12
+ <input type="text" onChange={onChange} value={text} />
13
+ <p>{text}</p>
14
+ </>
15
+ )
16
+}
17
18
+const root = createRoot(document.getElementById("root"))
19
+root.render(<LiveText />)
0 commit comments