Skip to content

Commit

Permalink
Merge pull request #1284 from nsbno/defined-own-use-const-as-the-one-…
Browse files Browse the repository at this point in the history
…from-chakra-causes-problems

implemented  useConst as the one from chakra caused problems
  • Loading branch information
Cmoen11 authored Oct 2, 2024
2 parents 0180508 + 125cabf commit c49460d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/docs/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "./styles/style-overrides.css";
import { cookieStorageManagerSSR, useConst } from "@chakra-ui/react";
import { cookieStorageManagerSSR } from "@chakra-ui/react";
import { withEmotionCache } from "@emotion/react";
import {
ActionFunctionArgs,
Expand All @@ -19,7 +19,7 @@ import {
useRouteError,
} from "@remix-run/react";
import { Brand, Language, SporProvider } from "@vygruppen/spor-react";
import { ReactNode, useContext, useEffect } from "react";
import { ReactNode, useContext, useEffect, useRef } from "react";
import { PageNotFound } from "./root/PageNotFound";
import { RootLayout } from "./root/layout/RootLayout";
import { SkipToContent } from "./root/layout/SkipToContent";
Expand Down Expand Up @@ -187,6 +187,11 @@ const Document = withEmotionCache(
},
);

function useConst<T>(value: T): T {
const ref = useRef(value);
return ref.current;
}

export default function App() {
const loaderData = useLoaderData<typeof loader>();

Expand Down

0 comments on commit c49460d

Please sign in to comment.