Skip to content

Commit

Permalink
adding solution
Browse files Browse the repository at this point in the history
  • Loading branch information
OrkunSA committed Dec 17, 2020
1 parent 23c4042 commit fc89bc6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
// Code ClickityClick Component Here
import React from "react";
class ClickityClick extends React.Component {
constructor() {
super();
this.state = {
hansBeenClicked: false,
currentTheme: "blue",
};
}

handleClick = () => {
this.setState(
{
hansBeenClicked: true,
},
() => console.log(this.state.hansBeenClicked)
);
};

render() {
return (
<div>
<p>I have {this.state.hansBeenClicked ? null : "not"} been clicked!</p>
<button onClick={this.handleClick}>Click me!</button>
</div>
);
}
}

export default ClickityClick;
13 changes: 5 additions & 8 deletions react-updating-state-onl01-seng-pt-041320/src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(
<div>
Mount Components Here
</div>,
document.getElementById('root')
);
import ClickityClick from "./components/ClickityClick";

ReactDOM.render(<ClickityClick />, document.getElementById("root"));

0 comments on commit fc89bc6

Please sign in to comment.