0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/ui-src/context/FigmaContext.tsx
Jordi Sala Morales 4b711b3526
Refactor context (#139)
* Refactor context

* fix

* fix
2024-06-04 18:02:59 +02:00

14 lines
481 B
TypeScript

import { JSX, PropsWithChildren } from 'react';
import { createGenericContext } from './createGenericContext';
import { UseFigmaHook, useFigma } from './useFigma';
const [useFigmaContext, StateContextProvider] = createGenericContext<UseFigmaHook>();
const FigmaProvider = ({ children }: PropsWithChildren): JSX.Element => {
const hook = useFigma();
return <StateContextProvider value={hook}>{children}</StateContextProvider>;
};
export { FigmaProvider, useFigmaContext };