UNPKG

react-imported-component

Version:
18 lines (17 loc) 689 B
import { __rest } from "tslib"; import * as React from 'react'; import { defaultStream } from '../loadable/stream'; export var streamContext = React.createContext(defaultStream); /** * SSR. Tracker for used marks */ export var ImportedStream = function (_a) { var stream = _a.stream, children = _a.children, props = __rest(_a, ["stream", "children"]); if (process.env.NODE_ENV !== 'development') { if ('takeUID' in props) { throw new Error('react-imported-component: `takeUID` was replaced by `stream`.'); } } return React.createElement(streamContext.Provider, { value: stream }, children); }; export var UIDConsumer = streamContext.Consumer;