Skip to content

Instantly share code, notes, and snippets.

@wschenk
Created November 28, 2017 02:41
Show Gist options
  • Save wschenk/a47790e7fc1834513cdd2c25323bd8b2 to your computer and use it in GitHub Desktop.
Save wschenk/a47790e7fc1834513cdd2c25323bd8b2 to your computer and use it in GitHub Desktop.
create-react-app login.js rmwc example
import React, {Component} from 'react'
import { TextField, Dialog } from 'rmwc';
class Login extends Component {
state = {email: "", password: ""}
handleChange = (val) => (evt) => { this.setState( {...this.state, [val]: evt.target.value} ) }
loginForm = () => {
return (
<div>
<TextField label="email" fullwidth onChange={this.handleChange('email')}/>
<TextField label="Password" type="password" fullwidth onChange={this.handleChange('password')}/>
</div>
)
}
render() {
return (
<Dialog
open={this.props.opened}
onClose={this.props.toggle}
title={"Login please!"}
onAccept={() => { console.log( this.state ) }}
body={this.loginForm()}
/>
)
}
}
export default Login;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment