@@ -17,7 +17,7 @@ class Login extends Component<{}, State> {
1717 txtEmail = React . createRef < HTMLInputElement > ( )
1818 txtPassword = React . createRef < HTMLInputElement > ( )
1919
20- login ( ) {
20+ login = ( ) => {
2121 const email = this . txtEmail . current ?. value
2222 const password = this . txtPassword . current ?. value
2323
@@ -27,7 +27,7 @@ class Login extends Component<{}, State> {
2727 } ) . catch ( error => this . setState ( { error : error . message } ) )
2828 }
2929
30- signup ( ) {
30+ signup = ( ) => {
3131 const email = this . txtEmail . current ?. value
3232 const password = this . txtPassword . current ?. value
3333
@@ -36,17 +36,14 @@ class Login extends Component<{}, State> {
3636 . then ( ( ) => this . login ( ) )
3737 }
3838
39- renderError = ( ) => {
40- return < p > { this . state . error } </ p >
41- }
4239
4340
4441 render ( ) {
4542 return < main className = "login container" >
4643 < div className = "row" >
4744 < div className = "col-12 col-6-tablet push-3-tablet text-center heading" >
4845 < h1 className = "font-100" > Log in or signup</ h1 >
49- { this . renderError ( ) }
46+ < p > { this . state . error } </ p >
5047 </ div >
5148 </ div >
5249 < div className = "row" >
@@ -60,11 +57,11 @@ class Login extends Component<{}, State> {
6057 < input ref = { this . txtPassword } className = "block" type = "password" name = "password" placeholder = "password" />
6158 </ fieldset >
6259
63- < button type = "button" className = "button button-primary block signup" onClick = { ( ) => this . login ( ) } >
60+ < button type = "button" className = "button button-primary block signup" onClick = { this . login } >
6461 Log in
6562 </ button >
6663
67- < button type = "button" className = "button button-primary block signup" onClick = { ( ) => this . signup ( ) } >
64+ < button type = "button" className = "button button-primary block signup" onClick = { this . signup } >
6865 Signup
6966 </ button >
7067 </ form >
0 commit comments