-
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.
- Loading branch information
1 parent
e67f700
commit 0ec8c0c
Showing
4 changed files
with
50 additions
and
217 deletions.
There are no files selected for viewing
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,13 +1,18 @@ | ||
import { useContext } from "react" | ||
import { useContext, useEffect } from "react" | ||
import ThePoolzContext from "../components/Context" | ||
import { RequiredContract } from "../types/IThePoolzInterface" | ||
|
||
export const useSetProvider = () => { | ||
const { setProvider } = useContext(ThePoolzContext) | ||
return setProvider | ||
} | ||
export const useThePoolz = (requiredContracts: RequiredContract[]) => { | ||
export const useThePoolz = (requiredContracts?: RequiredContract[]) => { | ||
const { thePoolz, setRequiredContracts } = useContext(ThePoolzContext) | ||
setRequiredContracts(requiredContracts) | ||
|
||
useEffect(() => { | ||
if (!requiredContracts) return | ||
setRequiredContracts(requiredContracts) | ||
}, [requiredContracts]) | ||
|
||
return thePoolz | ||
} |
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