-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathBioContext.tsx
31 lines (26 loc) · 849 Bytes
/
BioContext.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use client";
import { createContext, useState } from "react";
interface BioContextTypes {
output: { data: { bio: string }[] };
loading: boolean;
setOutput: React.Dispatch<React.SetStateAction<{ data: { bio: string }[] }>>;
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
}
export const BioContext = createContext<BioContextTypes>({
output: { data: [] },
loading: false,
setOutput: () => {},
setLoading: () => {},
});
export const BioProvider = ({ children }: { children: React.ReactNode }) => {
const [output, setOutput] = useState<{ data: { bio: string }[] }>({
data: [],
});
const [loading, setLoading] = useState(false);
console.log("Output Values: ", output);
return (
<BioContext.Provider value={{ output, setOutput, setLoading, loading }}>
{children}
</BioContext.Provider>
);
};