Package Exports
- react-csr
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-csr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-csr
Sample
You can use <NoSSR></NoSSR> to wrap the components wish to be rendered client side.
import { NoSSR } from './index';
import React from 'react';
class Com1 extends React.Component {
render() {
return <div></div>;
}
}
const Com2: React.FC = () => {
return <div></div>;
};
const Page = () => {
return (
<div>
<NoSSR>
<Com1 />>
<Com2 />>
</NoSSR>
</div>
);
};Or you can warp your component with a function
import { noSSR } from './index';
import React from 'react';
class Com1 extends React.Component {
render() {
return <div></div>;
}
}
const Com2: React.FC = () => {
return <div></div>;
};
const WrappedCom1 = noSSR(Com1);
const WrappedCom2 = noSSR(Com2);
const WrappedCom3 = noSSR(() => <div></div>);
interface Props {
a: string;
b: boolean;
c: number;
}
const WrappedCom4 = noSSR<Props>(({ a, b, c }) => {
return (
<div>
{a},{b}, {c}
</div>
);
});