From d770b3d64a546c48aa74c8dd70724a3fb618e48a Mon Sep 17 00:00:00 2001 From: maapteh Date: Sat, 23 Nov 2019 13:23:12 +0100 Subject: [PATCH] return null --- dist/index.js | 3 +-- package.json | 2 +- src/index.tsx | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index f5d7fe9e..43205e25 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,9 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); -var DefaultOnSSR = function () { return React.createElement("span", null); }; var NoSSR = function (_a) { - var children = _a.children, _b = _a.onSSR, onSSR = _b === void 0 ? React.createElement(DefaultOnSSR, null) : _b; + var children = _a.children, _b = _a.onSSR, onSSR = _b === void 0 ? null : _b; var _c = React.useState(false), render = _c[0], setRender = _c[1]; React.useEffect(function () { return setRender(true); }, []); if (!render) { diff --git a/package.json b/package.json index 054ecc8a..48930be5 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mpth/react-no-ssr", - "version": "0.0.5", + "version": "0.0.7", "description": "React component to wrap non SSR components.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.tsx b/src/index.tsx index 2264f94d..2ec40812 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,13 +1,11 @@ import * as React from 'react'; -const DefaultOnSSR = () => ; - interface Props { children: any; // React.ReactNode onSSR?: any; // JSX.Element } -const NoSSR = ({ children, onSSR = }: Props) => { +const NoSSR = ({ children, onSSR = null }: Props) => { const [render, setRender] = React.useState(false); React.useEffect(() => setRender(true), []);