diff --git a/README.md b/README.md index fd881bf9b..a138ac456 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,13 @@ This project includes a `src/components` folder containing several React compone ### Task 1: Project Set Up -- [ ] Create a forked copy of this project. -- [ ] Clone your OWN fork of the repository using your terminal. -- [ ] CD into the project base directory. -- [ ] Download project dependencies by running `npm install`. -- [ ] Start up the app using `npm start`. -- [ ] Optionally run tests using `npm test`. (The app must be running on `http://localhost:1234`) -- [ ] Push commits: `git push origin main`. +- [x] Create a forked copy of this project. +- [x] Clone your OWN fork of the repository using your terminal. +- [x] CD into the project base directory. +- [x] Download project dependencies by running `npm install`. +- [x] Start up the app using `npm start`. +- [x] Optionally run tests using `npm test`. (The app must be running on `http://localhost:1234`) +- [x] Push commits: `git push origin main`. ### Task 2a: Minimum Viable Product @@ -34,9 +34,9 @@ This project includes a `src/components` folder containing several React compone #### Steps -- [ ] You will add functionality to all components inside inside `src/components`. -- [ ] Work on the components **in the same order in which they display in Chrome** (to go from easiest challenge to hardest). -- [ ] Each file includes a link to a video, and a set of instructions which can be summarized as: +- [x] You will add functionality to all components inside inside `src/components`. +- [x] Work on the components **in the same order in which they display in Chrome** (to go from easiest challenge to hardest). +- [x] Each file includes a link to a video, and a set of instructions which can be summarized as: - Watch the video demoing the finished component, and think about how much state is needed. - Create the necessary slices of component state using the state hook. - Fix the JSX so it displays information derived from state, instead of hard-coded data. @@ -62,4 +62,4 @@ The move by the computer should probably be random if the previous checks turn o ## Submission Format -- [ ] Submit a link to your repo in canvas. +- [x] Submit a link to your repo in canvas. diff --git a/cypress.json b/cypress.json index acb2d0b3d..32a00b133 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,6 @@ { "viewportWidth": 800, "viewportHeight": 1200, - "baseUrl": "http://localhost:1234" + "baseUrl": "http://localhost:1234", + "projectId": "z8ccb8" } diff --git a/src/components/Counter.js b/src/components/Counter.js index 447a5e849..9b44453a8 100644 --- a/src/components/Counter.js +++ b/src/components/Counter.js @@ -46,32 +46,37 @@ STEP 6: This click handler needs to use 'setCount' to set the 'count' to be zero again. */ -import React from 'react'; /* STEP 0 */ +import React, { useState } from 'react'; export default function Counter() { /* STEP 1 */ +const [count, setCount] = useState(0); const increment = () => { /* STEP 4 */ + setCount(count + 1) + }; const decrement = () => { /* STEP 5 */ + setCount(count - 1) }; const reset = () => { /* STEP 6 */ + setCount(0) }; const style = { fontSize: '1.5em', marginBottom: '0.3em', - color: 'royalblue', /* STEP 2 */ + color: count % 2 === 0 ? 'royalblue' : 'crimson' }; return (