FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
custom-react-elements/example/component.jsx at fix/severity-issue · thread/custom-react-elements · GitHub
This repository was archived by the owner on May 14, 2024. It is now read-only.
thread
/
custom-react-elements
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
18
Code
Issues
0
Pull requests
3
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Security and quality
Insights
Expand file tree
Breadcrumbs
custom-react-elements
/
example
/
component.jsx
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (47 loc) · 1.04 KB
Breadcrumbs
custom-react-elements
/
example
/
component.jsx
Copy path
File metadata and controls
57 lines (47 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import
React
,
{
useState
,
useEffect
}
from
'react'
;
export
const
BasicComponent
=
(
)
=>
{
return
<
div
>
Hello world from React!
</
div
>
;
}
;
export
class
OldStyleComponent
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
;
this
.
state
=
{
count
:
0
}
;
}
componentDidMount
(
)
{
setInterval
(
(
)
=>
{
this
.
setState
(
p
=>
{
return
{
count
:
p
.
count
+
1
,
}
;
}
)
;
}
,
1000
)
;
}
render
(
)
{
return
<
div
>
Count:
{
this
.
state
.
count
}
</
div
>
;
}
}
export
const
ComponentWithProps
=
props
=>
{
const
[
counter
,
setCounter
]
=
useState
(
0
)
;
useEffect
(
(
)
=>
{
const
x
=
setInterval
(
(
)
=>
{
setCounter
(
c
=>
c
+
1
)
;
}
,
1000
)
;
return
(
)
=>
{
window
.
clearInterval
(
x
)
;
}
;
}
)
;
return
(
<
div
>
<
h1
>
Got
<
code
>
name
</
code
>
:
{
props
.
name
}
</
h1
>
<
h5
>
Counter:
{
counter
}
</
h5
>
<
p
>
JSON of the
<
code
>
demoObject
</
code
>
prop
</
p
>
<
pre
>
<
code
>
{
JSON
.
stringify
(
props
.
demoObject
,
null
,
4
)
}
</
code
>
</
pre
>
</
div
>
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL