piral-hooks-utils
Version:
Hooks and HOC for pilets and Piral instances.
13 lines • 524 B
JavaScript
import * as React from 'react';
import { PiletApiProvider } from '../contexts';
/**
* Wraps the component in a Pilet API provider allowing to make use of
* the `usePilet` hook.
* @param Component The component that should be wrapped in a provider.
* @returns The wrapped component.
*/
export function withPiletApi(Component) {
return (props) => (React.createElement(PiletApiProvider.Provider, { value: props.piral },
React.createElement(Component, { ...props })));
}
//# sourceMappingURL=withProvider.js.map