• Add support for react app context to a subapp

    Parameters

    Returns SubAppFeatureFactory

    subapp feature factory for app context

    Remark

    This is added by the declareSubApp API automatically.

    Example:

    import { ReactSubApp, appContextFeature, AppContext, React } from "@xarc/react";

    const Sample = () => {
    return (
    <AppContext.Consumer>
    {({ isSsr, ssr }) => {
    if (isSsr) {
    return <div>Server Side Rendering {ssr.request.url}</div>;
    }
    }}
    </AppContext.Consumer>
    );
    };

    export const subapp: ReactSubApp = {
    Component: Sample,
    wantFeatures: [appContextFeature()],
    };