Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
fb517c06
Commit
fb517c06
authored
Aug 11, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storybook
parent
67b02d6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
src/components/ts-test/index.tsx
+29
-14
No files found.
src/components/ts-test/index.tsx
View file @
fb517c06
import
React
,
{
Component
}
from
'react'
;
import
{
V
}
from
'src/common/course-card'
import
React
,
{
Component
,
useState
,
useEffect
,
useLayoutEffect
,
useRef
}
from
'react'
;
import
{
withRouter
,
RouteComponentProps
}
from
'react-router-dom'
c
lass
TSTest
extends
Component
<
RouteComponentProps
>
{
co
mponentDidMount
()
{
c
onst
TSTest
:
React
.
FC
=
()
=
>
{
co
nst
[
count
,
setCount
]
=
useState
(
0
);
function
handleAlertClick
()
{
setTimeout
(()
=>
{
alert
(
'You clicked on: '
+
count
);
},
3000
);
}
render
()
{
return
(
<
div
className=
{
'ts-test'
}
>
TS
<
V
title=
{
'a'
}
status=
{
2
}
courseId=
{
2
}
history=
{
this
.
props
.
history
}
image=
{
'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/20a86c1353.jpg'
}
></
V
>
</
div
>
);
}
return
(
<
div
>
<
p
>
You clicked
{
count
}
times
</
p
>
<
button
onClick=
{
()
=>
setCount
(
count
+
1
)
}
>
Click me
</
button
>
<
button
onClick=
{
handleAlertClick
}
>
Show alert
</
button
>
</
div
>
);
}
function
Message
({
text
}:
{
text
:
string
})
{
const
[
message
,
setMessage
]
=
useState
<
string
|
null
>
(
null
)
useEffect
(()
=>
{
setMessage
(
text
)
})
return
<
span
>
{
message
}
</
span
>
}
export
default
withRouter
(
TSTest
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment