import React from 'react'; import { CodeBlock } from 'UI' import ToggleContent from '../../../shared/ToggleContent'; import DocLink from 'Shared/DocLink/DocLink'; import { connect } from 'react-redux'; const ReduxDoc = (props) => { const { projectKey } = props; const usage = `import { applyMiddleware, createStore } from 'redux'; import OpenReplay from '@openreplay/tracker'; import trackerRedux from '@openreplay/tracker-redux'; //... const tracker = new OpenReplay({ projectKey: '${projectKey}' }); // .start() returns a promise tracker.start().then(sessionData => ... ).catch(e => ... ) //... const store = createStore( reducer, applyMiddleware(tracker.use(trackerRedux())) // check list of available options below );` const usageCjs = `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 // .start() returns a promise tracker.start().then(sessionData => ... ).catch(e => ... ) }, []) //... const store = createStore( reducer, applyMiddleware(tracker.use(trackerRedux())) // check list of available options below ); }` return (

Redux

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
Usage

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

} second={ } />
); }; ReduxDoc.displayName = 'ReduxDoc'; export default connect((state) => { const siteId = state.getIn(['integrations', 'siteId']); const sites = state.getIn(['site', 'list']); return { projectKey: sites.find((site) => site.get('id') === siteId).get('projectKey'), }; })(ReduxDoc);