diff --git a/components/extraReact.ts b/components/extraReact.ts index 564b61d..f45999a 100644 --- a/components/extraReact.ts +++ b/components/extraReact.ts @@ -1,4 +1,4 @@ -export function useClassState( +export function getClassState( useState: [S, React.Dispatch>] ): [S, (newState: Partial) => void] { const setState = (newState: Partial) => useState[1]((preState) => ({ ...preState, ...newState })); diff --git a/components/window.tsx b/components/window.tsx index 9faca29..452bc49 100644 --- a/components/window.tsx +++ b/components/window.tsx @@ -1,6 +1,6 @@ import React from "react"; import Repeat from "./repeat"; -import { useClassState } from './extraReact'; +import { getClassState } from './extraReact'; import randomId from "./randomId"; interface WindowProps { @@ -96,7 +96,7 @@ export function AllWindows({ zIndex, allWindow }: { export function getWindowFun( useState: [AllWindow, React.Dispatch>] ) { - const [allWindow, setAllWindow] = useClassState(useState); + const [allWindow, setAllWindow] = getClassState(useState); function addNewWindow( window: Window, Component: WindowTypeComArg diff --git a/pages/chat.tsx b/pages/chat.tsx index 27402a9..24b90b1 100644 --- a/pages/chat.tsx +++ b/pages/chat.tsx @@ -15,7 +15,7 @@ import { getStudentInfo, getStudentsJson } from '@/components/students/infoStude import Window, { AllWindow, getWindowFun } from '@/components/window'; import Repeat from '@/components/repeat'; import { AllWindows } from '@/components/window'; -import { useClassState } from '@/components/extraReact'; +import { getClassState } from '@/components/extraReact'; interface ContentProps { id: number, @@ -68,7 +68,7 @@ interface TextAlertArg { } export default function Info() { - const [state, setState] = useClassState(useState({ + const [state, setState] = getClassState(useState({ student: 0, studentsList: [10000, 10002], studentsJson: { data: {} },