import Highlight from 'react-highlight' import ToggleContent from '../../../shared/ToggleContent'; import DocLink from 'Shared/DocLink/DocLink'; const ReduxDoc = (props) => { const { projectKey } = 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: '${projectKey}' }); 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: '${projectKey}' }); //... 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 ); }`} } />
) }; ReduxDoc.displayName = "ReduxDoc"; export default ReduxDoc;