Last active
October 9, 2018 15:05
-
-
Save bedirhankaradogan/00c8aab70404936d6862d13067f9cb4d to your computer and use it in GitHub Desktop.
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, {Component} from "react"; | |
| import ReactDOM from "react-dom"; | |
| class ClassComponent extends Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| message: "Hello" | |
| } | |
| } | |
| logout = () => { | |
| this.setState({ | |
| message: "Good bye" | |
| }); | |
| } | |
| render() { | |
| const {message} = this.state; | |
| const { | |
| name, | |
| surname | |
| } = this.props; | |
| return ( | |
| <div onClick={this.logout}> | |
| {`${message}, ${name} ${surname}`} | |
| </div> | |
| ); | |
| } | |
| } | |
| const RenderClassComponents = () => { | |
| return <ClassComponent name={"Bedirhan"} surname={"Karadoğan"} />; | |
| } | |
| const rootElement = document.getElementById("root"); | |
| ReactDOM.render(<RenderClassComponents />, rootElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment