perf: add memo to react components

This commit is contained in:
SethBurkart123
2024-02-04 21:13:56 +11:00
parent 629a88a463
commit f5dfba2872
8 changed files with 25 additions and 15 deletions
+5 -2
View File
@@ -1,8 +1,9 @@
import { motion } from "framer-motion";
import "./Switch.css";
import type { SwitchProps } from "../types/SwitchProps";
import { memo } from "react";
export default function Switch(props: SwitchProps) {
function Switch(props: SwitchProps) {
const toggleSwitch = () => {
const newIsOn = !props.state;
props.onChange(newIsOn);
@@ -29,4 +30,6 @@ const spring = {
type: "spring",
stiffness: 700,
damping: 30
};
};
export default memo(Switch);