Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Slouchwind committed Apr 16, 2023
1 parent 4127c09 commit 0c633a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/extraReact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function useClassState<S>(
export function getClassState<S>(
useState: [S, React.Dispatch<React.SetStateAction<S>>]
): [S, (newState: Partial<S>) => void] {
const setState = (newState: Partial<S>) => useState[1]((preState) => ({ ...preState, ...newState }));
Expand Down
4 changes: 2 additions & 2 deletions components/window.tsx
Original file line number Diff line number Diff line change
@@ -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<C> {
Expand Down Expand Up @@ -96,7 +96,7 @@ export function AllWindows({ zIndex, allWindow }: {
export function getWindowFun(
useState: [AllWindow, React.Dispatch<React.SetStateAction<AllWindow>>]
) {
const [allWindow, setAllWindow] = useClassState(useState);
const [allWindow, setAllWindow] = getClassState(useState);
function addNewWindow<A>(
window: Window<A>,
Component: WindowTypeComArg<A>
Expand Down
4 changes: 2 additions & 2 deletions pages/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -68,7 +68,7 @@ interface TextAlertArg {
}

export default function Info() {
const [state, setState] = useClassState(useState<State>({
const [state, setState] = getClassState(useState<State>({
student: 0,
studentsList: [10000, 10002],
studentsJson: { data: {} },
Expand Down

0 comments on commit 0c633a5

Please sign in to comment.