-
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.
chore: added example to alt libs in docs chore: added more exports from local types
- Loading branch information
Showing
4 changed files
with
49 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from "react"; | ||
import * as Types from "./types"; | ||
import { createLoader } from "./createLoader"; | ||
|
||
/** | ||
* Allows you to create a loader inside of a component. | ||
* This is useful if you want to create a loader for use with `AwaitLoader`, scoped to a component. | ||
*/ | ||
export const useCreateLoader = < | ||
TProps extends unknown, | ||
TQueries extends Types._TQueries, | ||
TDeferred extends Types._TDeferred, | ||
TPayload extends Types._TPayload, | ||
TReturn extends unknown = Types.ResolveDataShape< | ||
Types.MakeDataRequired<TQueries>, | ||
TDeferred, | ||
TPayload | ||
>, | ||
TArg extends unknown = never | ||
>( | ||
createLoaderArgs: Types.CreateLoaderArgs< | ||
TProps, | ||
TQueries, | ||
TDeferred, | ||
TPayload, | ||
TReturn, | ||
TArg | ||
> | ||
) => { | ||
return React.useRef(createLoader(createLoaderArgs)).current; | ||
}; |