-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@kasper_573 rewrote the usePronous hoo to use useQuery, thank you! <3
- Loading branch information
Showing
5 changed files
with
70 additions
and
80 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
import { useContext } from "react"; | ||
import { useContext, useMemo } from "react"; | ||
import { AuthStateContext } from "./contexts/auth-state/AuthStateContext"; | ||
import LoginButton from "./components/LoginButton"; | ||
import Chat from "./components/Chat"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
|
||
export default function App() { | ||
const authContext = useContext(AuthStateContext); | ||
const queryClient = useMemo( | ||
() => | ||
new QueryClient({ | ||
defaultOptions: { queries: { staleTime: Infinity } }, | ||
}), | ||
[] | ||
); | ||
|
||
if (!authContext) { | ||
return <p>Missing AuthStateContext provider?</p>; | ||
} | ||
|
||
return ( | ||
<> | ||
<LoginButton /> | ||
{authContext.authState && ( | ||
<section> | ||
<p className="bg-pink-50"> | ||
Hello: {authContext.authState.user.login} | ||
</p> | ||
<article> | ||
<h2>Chat Messages:</h2> | ||
<Chat /> | ||
</article> | ||
</section> | ||
)} | ||
<QueryClientProvider client={queryClient}> | ||
<LoginButton /> | ||
{authContext.authState && ( | ||
<section> | ||
<p className="bg-pink-50"> | ||
Hello: {authContext.authState.user.login} | ||
</p> | ||
<article> | ||
<h2>Chat Messages:</h2> | ||
<Chat /> | ||
</article> | ||
</section> | ||
)} | ||
</QueryClientProvider> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters