-
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.
Merge pull request #29 from MauMuller/development
Development
- Loading branch information
Showing
18 changed files
with
431 additions
and
377 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
10 changes: 8 additions & 2 deletions
10
src/hooks/ValiskProvider/index.tsx → src/hooks/ValiskContext/index.tsx
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,14 +1,20 @@ | ||
import { FC, ReactNode, createContext } from "react"; | ||
import { FC, ReactNode, createContext, useContext } from "react"; | ||
import { ReturnValisk } from "../../types"; | ||
|
||
interface Props<T> extends ReturnValisk<T> { | ||
children: ReactNode; | ||
} | ||
|
||
export const ValiskContext = createContext({}); | ||
export const ValiskContext = createContext<ReturnValisk<any>>( | ||
{} as ReturnValisk<any> | ||
); | ||
|
||
export const ValiskProvider: FC<Props<any>> = ({ children, ...rest }) => { | ||
return ( | ||
<ValiskContext.Provider value={rest}>{children}</ValiskContext.Provider> | ||
); | ||
}; | ||
|
||
export const useValiskContext = <T,>() => { | ||
return useContext(ValiskContext) as ReturnValisk<T>; | ||
}; |
Oops, something went wrong.