@appbuckets/react-ui
Version:
Just Another React UI Framework
29 lines (26 loc) • 632 B
JavaScript
import { __read } from 'tslib';
import * as React from 'react';
import { useEnhancedEffect } from '@appbuckets/react-ui-core';
var NoSsr = function (props) {
var children = props.children,
fallback = props.fallback;
// ----
// Mounted State Management
// ----
var _a = __read(React.useState(false), 2),
mounted = _a[0],
setMounted = _a[1];
useEnhancedEffect(function () {
setMounted(true);
}, []);
// ----
// Component Render
// ----
return React.createElement(
React.Fragment,
null,
mounted ? children : fallback
);
};
NoSsr.displayName = 'NoSsr';
export { NoSsr as default };