1- /**
2- *
3- * Original: https://codesandbox.io/s/usereactsaga-usereducer-exercise-stuctured-into-files-context-api-pnsdk?file=/src/App.js
4- */
5-
61import React from "react" ;
72
83import ButtonComponent from "./components/ButtonComponent" ;
9-
10- import DisplayStateComponent from "./components/DisplayStateComponent" ;
11-
12- import PrettyPrint from "./components/PrettyPrint" ;
4+ import FooterComponent from "./components/FooterComponent" ;
5+ import HeaderComponent from "./components/HeaderComponent" ;
136
147import { useDataLayerValue } from "./context/DataLayer" ;
158
169import "./styles.css" ;
1710
1811export default function App ( ) {
19- const { state, put } = useDataLayerValue ( ) ;
12+ const {
13+ // state,//so es-lint does not brag!
14+ put,
15+ } = useDataLayerValue ( ) ;
2016
2117 function handleClick1 ( ) {
2218 put ( { type : "INCREMENT_COUNTER_1_START" } ) ;
@@ -28,23 +24,31 @@ export default function App() {
2824
2925 return (
3026 < div className = "App" >
31- { /* Imagine this is in the header of your website */ }
32- Header < DisplayStateComponent />
33- < hr />
34- < ButtonComponent
35- instructions = "Increment counter 1"
36- onClick = { handleClick1 }
37- />
38- < hr />
39- < ButtonComponent
40- instructions = "Increment counter 2"
41- onClick = { handleClick2 }
42- />
43- < hr />
44- State: < PrettyPrint toPrint = { state } />
45- < hr />
46- { /* and this the footer */ }
47- Footer < DisplayStateComponent />
27+ < p >
28+ Imagine this is an actual website, where components need to display some
29+ state, or let's be crazy: even set some state !
30+ </ p >
31+
32+ < HeaderComponent />
33+
34+ < p >
35+ We, buttons below, live on the ground floor, level 0, in the App.js file
36+ directly but, we're cool!
37+ </ p >
38+
39+ < p className = "App__groundFloor" >
40+ < ButtonComponent
41+ instructions = "Press me to increment counter 1"
42+ onClick = { handleClick1 }
43+ />
44+ < hr />
45+ < ButtonComponent
46+ instructions = "No no, press me to increment counter 2, he's much better ;)"
47+ onClick = { handleClick2 }
48+ />
49+ </ p >
50+
51+ < FooterComponent />
4852 </ div >
4953 ) ;
5054}
0 commit comments