UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

53 lines (52 loc) 1.55 kB
import React from "react"; import type { ReactNode } from "react"; export interface ReplykeIntegrationProviderProps { children: ReactNode; projectId: string; signedToken?: string | null; } /** * Integration provider for Replyke (Integration Mode). * * Use this when you HAVE your own Redux store and want to integrate * Replyke's reducers into it. This provider does NOT create a Redux store - * you must wrap your app with your own Redux Provider. * * Prerequisites: * 1. Add replykeReducers under the 'replyke' key in your store * 2. Add replykeApiReducer under the 'replykeApi' key * 3. Add replykeMiddleware to your middleware chain * * @example * ```tsx * import { configureStore } from '@reduxjs/toolkit'; * import { Provider } from 'react-redux'; * import { * ReplykeIntegrationProvider, * replykeReducers, * replykeApiReducer, * replykeMiddleware * } from '@replyke/react-js'; * * const store = configureStore({ * reducer: { * replyke: replykeReducers, * replykeApi: replykeApiReducer, * ...yourReducers * }, * middleware: (getDefault) => getDefault().concat(...replykeMiddleware) * }); * * function App() { * return ( * <Provider store={store}> * <ReplykeIntegrationProvider projectId="..." signedToken={token}> * <YourApp /> * </ReplykeIntegrationProvider> * </Provider> * ); * } * ``` */ export declare const ReplykeIntegrationProvider: React.FC<ReplykeIntegrationProviderProps>; export default ReplykeIntegrationProvider;