Commit fb517c06 by zhanghaozhe

storybook

parent 67b02d6d
import React, {Component} from 'react'; import React, {Component, useState, useEffect, useLayoutEffect, useRef} from 'react';
import {V} from 'src/common/course-card'
import {withRouter, RouteComponentProps} from 'react-router-dom' import {withRouter, RouteComponentProps} from 'react-router-dom'
class TSTest extends Component<RouteComponentProps> { const TSTest: React.FC = () => {
componentDidMount() { const [count, setCount] = useState(0);
function handleAlertClick() {
setTimeout(() => {
alert('You clicked on: ' + count);
}, 3000);
} }
render() { return (
return ( <div>
<div className={'ts-test'}> <p>You clicked {count} times</p>
TS <button onClick={() => setCount(count + 1)}>
<V title={'a'} status={2} courseId={2} Click me
history={this.props.history} </button>
image={'https://julyedu-img-public.oss-cn-beijing.aliyuncs.com/Public/Image/20a86c1353.jpg'}></V> <button onClick={handleAlertClick}>
</div> 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); export default withRouter(TSTest);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment