-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
41 lines (37 loc) · 1.12 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React, { useState } from "react";
import ReactDOM from "react-dom/client";
import EmailAddress from "email-obfuscator-webcomponent";
import encodedImg from "../vbvfro8215e.png?url";
customElements.define("email-address", EmailAddress);
function App() {
const [count, setCount] = useState(0);
return (
<main style={{ display: "flex", flexDirection: "column" }}>
<h1>Hello From React!</h1>
<email-address src={encodedImg}></email-address>
<div
style={{
display: "flex",
justifyContent: "center",
gap: "1rem",
marginBlock: "2rem",
}}
>
<button onClick={() => setCount((count) => count - 1)}>-</button>
<span>{count}</span>
<button onClick={() => setCount((count) => count + 1)}>+</button>
</div>
<a
style={{ textAlign: "center" }}
href="https://github.com/rumaan/email-obfuscator-webcomponent/tree/main/demo/react"
>
Source
</a>
</main>
);
}
ReactDOM.createRoot(document.getElementById("app") as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>
);