Last active
August 18, 2018 07:06
-
-
Save raidenz/e6b597b85e9c2c78003701a04b012301 to your computer and use it in GitHub Desktop.
:medium: smart component
This file contains hidden or 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 React from 'react' | |
class Statefull extends React.Component { | |
constructor(props){ | |
super(props) | |
this.state={ | |
name: '' | |
} | |
} | |
handleChange = (e) => { | |
const {name, value} = e.target | |
this.setState({ | |
name: value | |
}) | |
} | |
render(){ | |
return( | |
<div> | |
Statefull Component | |
<div> | |
name: {this.state.name} | |
</div> | |
<input name="name" value={this.state.name} onChange={this.handleChange}/> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment