From 17c1d3d2070ee0c060c3e71a9e5868f004b2b034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Tue, 16 May 2023 19:52:29 -0600 Subject: Start point. Visit https://github.com/nvh95/vite-react-template-redux to see original template. --- src/features/counter/Counter.jsx | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/features/counter/Counter.jsx (limited to 'src/features/counter/Counter.jsx') diff --git a/src/features/counter/Counter.jsx b/src/features/counter/Counter.jsx new file mode 100644 index 0000000..37d866d --- /dev/null +++ b/src/features/counter/Counter.jsx @@ -0,0 +1,67 @@ +import React, { useState } from "react"; +import { useSelector, useDispatch } from "react-redux"; +import { + decrement, + increment, + incrementByAmount, + incrementAsync, + incrementIfOdd, + selectCount, +} from "./counterSlice"; +import styles from "./Counter.module.css"; + +export function Counter() { + const count = useSelector(selectCount); + const dispatch = useDispatch(); + const [incrementAmount, setIncrementAmount] = useState("2"); + + const incrementValue = Number(incrementAmount) || 0; + + return ( +
+
+ + {count} + +
+
+ setIncrementAmount(e.target.value)} + /> + + + +
+
+ ); +} -- cgit v1.2.3