import Highlight from 'react-highlight' import ToggleContent from '../../../shared/ToggleContent'; const ReduxDoc = (props) => { return (
This plugin allows you to capture Redux actions/state and inspect them later on while replaying session recordings. This is very useful for understanding and fixing issues.
Installation
{`npm i @openreplay/tracker-redux --save`}
Usage

Initialize the tracker then put the generated middleware into your Redux chain.

{`import { applyMiddleware, createStore } from 'redux'; import OpenReplay from '@openreplay/tracker'; import trackerRedux from '@openreplay/tracker-redux'; //... const tracker = new OpenReplay({ projectKey: PROJECT_KEY }); tracker.start(); //... const store = createStore( reducer, applyMiddleware(tracker.use(trackerRedux())) // check list of available options below );`} } second={ {`import { applyMiddleware, createStore } from 'redux'; import OpenReplay from '@openreplay/tracker/cjs'; import trackerRedux from '@openreplay/tracker-redux/cjs'; //... const tracker = new OpenReplay({ projectKey: PROJECT_KEY }); //... function SomeFunctionalComponent() { useEffect(() => { // or componentDidMount in case of Class approach tracker.start(); }, []) //... const store = createStore( reducer, applyMiddleware(tracker.use(trackerRedux())) // check list of available options below ); }`} } />
See API for more options.
) }; ReduxDoc.displayName = "ReduxDoc"; export default ReduxDoc;