next-redux-wrapper

  • Version 8.1.0
  • Published
  • 76.5 kB
  • No dependencies
  • MIT license

Install

npm i next-redux-wrapper
yarn add next-redux-wrapper
pnpm add next-redux-wrapper

Overview

Redux wrapper for Next.js

Index

Variables

variable HYDRATE

const HYDRATE: string;
  • Quick note on Next.js return types:

    Page.getInitialProps https://nextjs.org/docs/api-reference/data-fetching/getInitialProps as-is

    App.getInitialProps: AppInitialProps https://nextjs.org/docs/advanced-features/custom-app {pageProps: any}

    getStaticProps https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation {props: any}

    getServerSideProps https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering {props: any}

Functions

function _default

_default: <S extends Store<any, any>>(
makeStore: MakeStore<S>,
config?: Config<S>
) => (Component: any) => {
(props: any): JSX.Element;
displayName: string;
getInitialProps: any;
};

    function createWrapper

    createWrapper: <S extends Store<any, any>>(
    makeStore: MakeStore<S>,
    config?: Config<S>
    ) => {
    getServerSideProps: <P extends {} = any>(
    callback: GetServerSidePropsCallback<S, P>
    ) => GetServerSideProps<P, any, any>;
    getStaticProps: <P_1 extends {} = any>(
    callback: GetStaticPropsCallback<S, P_1>
    ) => GetStaticProps<P_1, any, any>;
    getInitialAppProps: <P_2 extends {} = any>(
    callback: AppCallback<S, P_2>
    ) => GetInitialAppProps<P_2>;
    getInitialPageProps: <P_3 extends {} = any>(
    callback: PageCallback<S, P_3>
    ) => (context: NextPageContext<any>) => any;
    withRedux: (Component: NextComponentType | App | any) => {
    (props: any): JSX.Element;
    displayName: string;
    getInitialProps: any;
    };
    useWrappedStore: (
    { initialState: giapState, initialProps, ...props }: any,
    displayName?: string
    ) => { store: S; props: any };
    };

      Interfaces

      interface Config

      interface Config<S extends Store> {}

        property debug

        debug?: boolean;

          property deserializeState

          deserializeState?: (state: any) => ReturnType<S['getState']>;

            property serializeState

            serializeState?: (state: ReturnType<S['getState']>) => any;

              interface InitStoreOptions

              interface InitStoreOptions<S extends Store> {}

                property context

                context?: Context;

                  property makeStore

                  makeStore: MakeStore<S>;

                    interface WrapperProps

                    interface WrapperProps {}

                      property initialProps

                      initialProps: any;

                        property initialState

                        initialState: any;

                          Type Aliases

                          type AppCallback

                          type AppCallback<S extends Store, P> = (store: S) => GetInitialAppProps<P>;

                            type Callback

                            type Callback<
                            S extends Store,
                            P extends {
                            [key: string]: any;
                            }
                            > =
                            | GetStaticPropsCallback<S, P>
                            | GetServerSidePropsCallback<S, P>
                            | PageCallback<S, P>
                            | AppCallback<S, P>;

                              type Context

                              type Context =
                              | NextPageContext
                              | AppContext
                              | GetStaticPropsContext
                              | GetServerSidePropsContext;

                                type GetServerSidePropsCallback

                                type GetServerSidePropsCallback<
                                S extends Store,
                                P extends {
                                [key: string]: any;
                                }
                                > = (store: S) => GetServerSideProps<P>;

                                  type GetStaticPropsCallback

                                  type GetStaticPropsCallback<
                                  S extends Store,
                                  P extends {
                                  [key: string]: any;
                                  }
                                  > = (store: S) => GetStaticProps<P>;

                                    type MakeStore

                                    type MakeStore<S extends Store> = (context: Context) => S;

                                      type PageCallback

                                      type PageCallback<S extends Store, P> = (store: S) => GetInitialPageProps<P>;

                                        Package Files (1)

                                        Dependencies (0)

                                        No dependencies.

                                        Dev Dependencies (19)

                                        Peer Dependencies (3)

                                        Badge

                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/next-redux-wrapper.

                                        • Markdown
                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/next-redux-wrapper)
                                        • HTML
                                          <a href="https://www.jsdocs.io/package/next-redux-wrapper"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>