-
-
Save thomasdavis/4a167412359579800d3371cfcb0fa4dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "react"; | |
import styled from "styled-components"; | |
const Layout = styled.div` | |
background: red; | |
width: 200px; | |
height: 200px; | |
`; | |
const Input = styled.input` | |
padding: 15px; | |
width: 100px; | |
`; | |
const SomeButton = styled.button``; | |
export default class Connections extends Component { | |
state = { | |
word: "" | |
}; | |
alertMe = () => { | |
alert(this.state.word); | |
}; | |
onWordChange = ev => { | |
this.setState({ | |
word: ev.target.value | |
}); | |
}; | |
render() { | |
const { word } = this.state; | |
return ( | |
<Layout> | |
<Input value={word} onChange={this.onWordChange} /> | |
<SomeButton onClick={this.alertMe}>Click me</SomeButton> | |
</Layout> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment