mirror of
https://github.com/UiO-Gaming/bebbes.git
synced 2026-11-05 13:56:50 +01:00
remove redundant react-hook-form
This commit is contained in:
1 parent
54b03fcfc8
commit
65ee2731b1
3 files changed
+4
-44
No files matched your search
Generated
+3
-26
@@ -9,8 +9,7 @@
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1",
|
||||
"react-hook-form": "^7.91.0"
|
||||
"react-dom": "^19.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.3.0",
|
||||
@@ -653,7 +652,7 @@
|
||||
"version": "19.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
|
||||
"integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
|
||||
"devOptional": true,
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"csstype": "^3.2.2"
|
||||
@@ -1130,7 +1129,7 @@
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"devOptional": true,
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/debug": {
|
||||
@@ -2118,28 +2117,6 @@
|
||||
"react": "^19.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react-hook-form": {
|
||||
"version": "7.91.0",
|
||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.91.0.tgz",
|
||||
"integrity": "sha512-5BEBUnCBwa28AFXYTYmOaB/+CSpJ/+CWVASHEvIGUzFdHyUiPHeRhG7r5hOZ8nZi0yP7pbHdFNXO/p31EKTJFQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/react-hook-form"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8.0 || ^17 || ^18 || ^19"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.1.1.tgz",
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1",
|
||||
"react-hook-form": "^7.91.0"
|
||||
"react-dom": "^19.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.3.0",
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import styles from "./calculator.module.css";
|
||||
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
type calcTypes = {
|
||||
people: number;
|
||||
thirstyness: number;
|
||||
hungriness: number;
|
||||
};
|
||||
|
||||
const calculateLiters = (people: number, thirstyness: number) => {
|
||||
return Math.ceil(people * thirstyness);
|
||||
};
|
||||
@@ -26,11 +18,6 @@ const calculatePizzas = (people: number, hungriness: number) => {
|
||||
};
|
||||
|
||||
const Calculator = () => {
|
||||
const {
|
||||
register,
|
||||
formState: { errors },
|
||||
} = useForm<calcTypes>();
|
||||
|
||||
const [people, setPeople] = useState(0);
|
||||
const [thirstyness, setThirstyness] = useState(0.5);
|
||||
const [hungriness, setHungriness] = useState(3);
|
||||
@@ -42,7 +29,6 @@ const Calculator = () => {
|
||||
className={styles.formPeople}
|
||||
type="number"
|
||||
placeholder="Antall personer"
|
||||
{...(register("people"), { required: true, min: 1, max: 3000 })}
|
||||
onChange={(e) => {
|
||||
if (!e.target.value) {
|
||||
setPeople(0);
|
||||
@@ -53,7 +39,6 @@ const Calculator = () => {
|
||||
/>
|
||||
|
||||
<select
|
||||
{...register("thirstyness")}
|
||||
onChange={(e) => {
|
||||
setThirstyness(Number(e.target.value));
|
||||
}}
|
||||
@@ -66,7 +51,6 @@ const Calculator = () => {
|
||||
</select>
|
||||
|
||||
<select
|
||||
{...register("hungriness")}
|
||||
onChange={(e) => {
|
||||
setHungriness(Number(e.target.value));
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user