mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 19:54:39 +00:00
perf: add memo to react components
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user