Created
June 10, 2019 12:47
-
-
Save JimRottinger/b287a5d295d1546fd2a0dad4a8006d2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 React from 'react'; | |
export interface SampleComponentProps { | |
firstword: string, | |
secondword: string | |
} | |
export interface SampleComponentState { | |
phrase: string | |
} | |
class SampleComponent extends React.Component<SampleComponentProps, SampleComponentState> { | |
readonly state: SampleComponentState = { | |
phrase: '' | |
} | |
constructor(props: SampleComponentProps) { | |
super(props) | |
this.state = { | |
phrase: `${props.firstword} ${props.secondword}` | |
} | |
} | |
render () { | |
const { phrase } = this.state | |
return ( | |
<div> | |
<p>{phrase}</p> | |
</div> | |
) | |
} | |
} | |
export default SampleComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment