-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
import { useBeforeMount } from '@mediamonks/react-hooks';
import { useState } from 'react';
export function useAsyncValue<T extends () => any>(initializeFunction: T): Awaited<ReturnType<T>> | undefined {
const [value, setValue] = useState<Awaited<ReturnType<T>> | undefined>();
useBeforeMount(async () => {
setValue(await initializeFunction());
});
return value;
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed