From 02feb7b9f6237a3dd27d7dc411455fa4fee3f8cc Mon Sep 17 00:00:00 2001 From: 3takita <98113361+3takita@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:25:17 -0800 Subject: [PATCH] initial commit --- package.json | 15 ++++++++---- src/App.js | 22 +++++++++++++++--- src/Count.js | 9 ++++++++ src/styles.css | 62 +++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 97 insertions(+), 11 deletions(-) create mode 100644 src/Count.js diff --git a/package.json b/package.json index 0a80b6a..bc19501 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "react", + "name": "props-counter-app", "version": "1.0.0", - "description": "React example starter project", - "keywords": ["react", "starter"], + "description": "", + "keywords": [], "main": "src/index.js", "dependencies": { "react": "17.0.2", @@ -19,5 +19,10 @@ "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, - "browserslist": [">0.2%", "not dead", "not ie <= 11", "not op_mini all"] -} + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ] +} \ No newline at end of file diff --git a/src/App.js b/src/App.js index dbc5c59..7e22071 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,26 @@ +import React from "react"; import "./styles.css"; +import Count from "./Count"; export default function App() { + const [count, setCount] = React.useState(0); + + function add() { + setCount((prevCount) => prevCount + 1); + } + function subtract() { + setCount((prevCount) => prevCount - 1); + } + return ( -