mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
checking in docs for github.io page
This commit is contained in:
25
docs/step1-04/src/components/Counter.tsx
Normal file
25
docs/step1-04/src/components/Counter.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Button } from './Button';
|
||||
|
||||
export class Counter extends React.Component<any, any> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
counter: props.start
|
||||
};
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<span> {this.state.counter} </span>
|
||||
<Button
|
||||
onClick={() => {
|
||||
this.setState({ counter: this.state.counter + 1 });
|
||||
}}
|
||||
>
|
||||
Click Me
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user