@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
18 lines • 869 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext } from "react";
import useEntityData from "../hooks/entities/useEntityData";
export const EntityContext = createContext({});
export const EntityProvider = ({ children, ...restOfProps }) => {
const data = useEntityData(restOfProps);
if (!('foreignId' in restOfProps && restOfProps.foreignId) &&
!('entityId' in restOfProps && restOfProps.entityId) &&
!('shortId' in restOfProps && restOfProps.shortId) &&
!('entity' in restOfProps && restOfProps.entity?.id)) {
// console.warn(
// "Please pass an entity ID, reference ID, short ID or a complete entity object to the EntityProvider"
// );
return null;
}
return (_jsx(EntityContext.Provider, { value: data, children: children }));
};
//# sourceMappingURL=entity-context.js.map