Skip to content

Commit 04d8498

Browse files
committed
feat: add live-paragraph.jsx solution
1 parent b8c5bd4 commit 04d8498

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

solutions/live-paragraph.jsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy