mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
wrapped context vlaues with usememo
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import { useLocation } from "@/hook/useLocation";
|
||||
import { useSocketListener } from "@/hook/useSocketListener";
|
||||
import { createContext, useContext, useEffect, useState } from "react";
|
||||
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
||||
import { useSocket } from "./socketContext";
|
||||
import { useTeamConnexion } from "./teamConnexionContext";
|
||||
|
||||
@@ -22,8 +22,9 @@ function TeamProvider({children}) {
|
||||
}
|
||||
}, [loggedIn, currentPosition]);
|
||||
|
||||
const value = useMemo(() => ({enemyPosition, currentPosition}), [enemyPosition, currentPosition]);
|
||||
return (
|
||||
<teamContext.Provider value={{enemyPosition, currentPosition}}>
|
||||
<teamContext.Provider value={value}>
|
||||
{children}
|
||||
</teamContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user