-
-
Save mredem96/ca2afaffd695d270db3314db1804c03e to your computer and use it in GitHub Desktop.
Statefull components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
interface IStateComponent{ | |
time:Date(); | |
} | |
interface IPropComponent{ | |
name:string; | |
} | |
export class TypedComponent extends React.Component<IPropComponent,IStateComponent>{ | |
constructor(props : IMyComponentProps) { | |
super(props); | |
this.state = { time: new Date(); }; | |
} | |
public render() { | |
return ( | |
<div> | |
My name is {this.props.name} | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment