Skip to content

Instantly share code, notes, and snippets.

@thomashagstrom
Created January 14, 2019 07:51
Show Gist options
  • Save thomashagstrom/79f098c008cbc3d1801db59ce1490776 to your computer and use it in GitHub Desktop.
Save thomashagstrom/79f098c008cbc3d1801db59ce1490776 to your computer and use it in GitHub Desktop.
React component with arrow function
export class CognitoLogin extends React.Component<
ICognitoLoginProps,
ICognitoLoginState
> {
constructor(props: ICognitoLoginProps) {
super(props);
this.state = {
userInput: __DEV__
? {
email: 'cogtest@mailinator.com',
password: 'Password1#',
phone: '+46730555252',
}
: { email: undefined, password: undefined },
};
}
onEmailChanged = (email: string | undefined) => {
const { userInput } = this.state;
if (_.isNil(email)) {
return;
}
userInput.email = email;
this.setState({ userInput });
}
render(){}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment