Skip to content

Instantly share code, notes, and snippets.

@JimRottinger
Created June 10, 2019 12:47
Show Gist options
  • Save JimRottinger/b287a5d295d1546fd2a0dad4a8006d2c to your computer and use it in GitHub Desktop.
Save JimRottinger/b287a5d295d1546fd2a0dad4a8006d2c to your computer and use it in GitHub Desktop.
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