Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save bedirhankaradogan/00c8aab70404936d6862d13067f9cb4d to your computer and use it in GitHub Desktop.

Select an option

Save bedirhankaradogan/00c8aab70404936d6862d13067f9cb4d to your computer and use it in GitHub Desktop.
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