react-imported-component
Version:
I will import your component, and help to handle it
16 lines (15 loc) • 589 B
JavaScript
import * as React from 'react';
import { defaultStream } from '../loadable/stream';
export const streamContext = React.createContext(defaultStream);
/**
* SSR. Tracker for used marks
*/
export const ImportedStream = ({ stream, children, ...props }) => {
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 const UIDConsumer = streamContext.Consumer;