diff --git a/02/src/App.js b/02/src/App.js
index 1e284458..733167ca 100644
--- a/02/src/App.js
+++ b/02/src/App.js
@@ -2,7 +2,8 @@ import React from 'react';
import './App.css';
import Person from './Person/Person';
-// // ## Functional code generated by creat-react-app ##
+
+/* // ## Functional code generated by creat-react-app ##
// function App() {
// return (
//
@@ -16,8 +17,9 @@ import Person from './Person/Person';
// );
// // return React.createElement('div', {className: 'App'}, React.createElement('h1', null, `Oh Hay I'm a React App!!!`));
// }
+*/
-// // ## Functional code created using ES6 (React Hooks) ##
+/* // ## Functional code created using ES6 (React Hooks) ##
// const App = props => {
// const [charState, setCharState] = React.useState({
// character: [
@@ -62,6 +64,12 @@ import Person from './Person/Person';
// );
// // return React.createElement('div', {className: 'App'}, React.createElement('h1', null, `Oh Hay I'm a React App!!!`));
// }
+*/
+
+/* // ## What's behind each JSX tag ##
+// render() {
+// return React.createElement('div', {className: 'App'}, React.createElement('h1', null, `Oh Hay I'm a React App!!!`));
+// }*/
// ## OOP code ##
@@ -72,7 +80,8 @@ class App extends React.Component {
{ name: 'char2', ilvl: 110 },
{ name: 'char3', ilvl: 78 }
],
- somethingElse: 'something something'
+ somethingElse: 'something something',
+ showOrHide: false
}
switchNameHandler = () => {
@@ -98,43 +107,56 @@ class App extends React.Component {
})
}
+ showOrHide = () => {
+ const doesShow = this.state.showOrHide
+ this.setState({showOrHide: !doesShow})
+ }
+
render() {
const style = {
backgroundColor: 'white',
font: 'inherit',
border: '1px solid blue',
padding: '8px',
+ margin: '10px',
cursor: 'pointer'
};
return (
-
+
Hi, I'm a React App, I'm cute.
Created using OOP code
-
-
-
- {/*
-
Main Character
-
-
*/}
+ onClick={() => this.switchNameHandler()}>
+ Switch Char
+
+
+ {this.state.showOrHide
+ ?
+
: null
+ }
);
- // return React.createElement('div', {className: 'App'}, React.createElement('h1', null, `Oh Hay I'm a React App!!!`));
}
}