mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-14 09:26:49 +02:00
First public commit
This commit is contained in:
commit
e05cd62e53
228 changed files with 17717 additions and 0 deletions
12
components/use-poll.ts
Normal file
12
components/use-poll.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { GetPollResponse } from "api-client/get-poll";
|
||||
import React from "react";
|
||||
|
||||
export const PollContext = React.createContext<GetPollResponse | null>(null);
|
||||
|
||||
export const usePoll = () => {
|
||||
const context = React.useContext(PollContext);
|
||||
if (!context) {
|
||||
throw new Error("Tried to get poll from context but got undefined");
|
||||
}
|
||||
return context;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue