Skip to content

Instantly share code, notes, and snippets.

@methodbox
Last active July 24, 2019 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save methodbox/34e5db3831ffa1ca8ef78608807ce703 to your computer and use it in GitHub Desktop.
Save methodbox/34e5db3831ffa1ca8ef78608807ce703 to your computer and use it in GitHub Desktop.
Get Started with TypeScript - Part 2 - State assigned to state
type State = {
appTitle: string;
launchImg: string;
rocketName: string;
missionName: string;
missionLogo: string;
missionDetails: string;
missionSuccess: boolean;
flightNumber: number;
missionId: string;
launchDate: string;
payloadSize: number;
ships: Array<string>;
isShowingMissionData: boolean;
};
export default class RocketApp extends React.Component<{}, State> {
state: State = {
appTitle: 'SpaceX Launches',
launchImg: '',
rocketName: '',
missionName: '',
missionLogo: '',
missionDetails: '',
missionSuccess: false,
flightNumber: 0,
missionId: '',
launchDate: '',
payloadSize: 0,
ships: [],
isShowingMissionData: false,
};
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment