React component for rendering Server Side Includes. For using with MicroFrontend services (or really anything that returns html
).
npm install --save react-ssi-fragment
yarn add react-ssi-fragment
The component is meant to be used alongside Server Side Rendering (SSR from now on). As such, it's usage looks like this:
import { SSIFragment } from 'react-ssi-fragment';
const Component = () => (
<SSIFragment
id="container-id"
url="https://example-micro-frontend.com/microfrontend"
isOnClient={false}
/>
)
import { SSIFragment } from 'react-ssi-fragment';
const Component = () => (
<SSIFragment
id="container-id"
url="https://example-micro-frontend.com/microfrontend"
isOnClient={true}
/>
)
If for any reason you need a class component and not the hook based implementation, you can use import { SSIFragmentClass } from 'react-ssi-fragment/lib/SSIFragmentClass'
The components interface is typed.