mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
11 lines
287 B
TypeScript
11 lines
287 B
TypeScript
import * as React from 'react';
|
|
|
|
export type ContextShimProps<T> = {
|
|
context: React.Context<T>;
|
|
children: (data: T) => any;
|
|
};
|
|
|
|
export function ContextShim<T>(props: ContextShimProps<T>) {
|
|
const context = React.useContext(props.context);
|
|
return <>{props.children(context)}</>;
|
|
}
|