mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-12 08:26:48 +02:00
First public commit
This commit is contained in:
commit
e05cd62e53
228 changed files with 17717 additions and 0 deletions
12
components/user-name-context.tsx
Normal file
12
components/user-name-context.tsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
import React from "react";
|
||||
|
||||
export const UserNameContext =
|
||||
React.createContext<[string, (userName: string) => void] | null>(null);
|
||||
|
||||
export const useUserName = () => {
|
||||
const contextValue = React.useContext(UserNameContext);
|
||||
if (contextValue === null) {
|
||||
throw new Error("Missing UserNameContext.Provider");
|
||||
}
|
||||
return contextValue;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue