import React from 'react'; import Highlight from 'react-highlight'; import ToggleContent from 'Shared/ToggleContent'; import DocLink from 'Shared/DocLink/DocLink'; import { connect } from 'react-redux'; const NgRxDoc = (props) => { const { projectKey } = props; return (

NgRx

This plugin allows you to capture NgRx 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-ngrx --save`}
Usage

Add the generated meta-reducer into your imports. See NgRx documentation for more details.

Usage
{`import { StoreModule } from '@ngrx/store'; import { reducers } from './reducers'; import OpenReplay from '@openreplay/tracker'; import trackerNgRx from '@openreplay/tracker-ngrx'; //... const tracker = new OpenReplay({ projectKey: '${projectKey}' }); tracker.start(); //... const metaReducers = [tracker.use(trackerNgRx())]; // check list of available options below //... @NgModule({ imports: [StoreModule.forRoot(reducers, { metaReducers })] }) export class AppModule {}`} } second={ {`import { StoreModule } from '@ngrx/store'; import { reducers } from './reducers'; import OpenReplay from '@openreplay/tracker/cjs'; import trackerNgRx from '@openreplay/tracker-ngrx/cjs'; //... const tracker = new OpenReplay({ projectKey: '${projectKey}' }); //... function SomeFunctionalComponent() { useEffect(() => { // or componentDidMount in case of Class approach tracker.start(); }, []) //... const metaReducers = [tracker.use(trackerNgRx())]; // check list of available options below //... @NgModule({ imports: [StoreModule.forRoot(reducers, { metaReducers })] }) export class AppModule {} }`} } />
); }; NgRxDoc.displayName = 'NgRxDoc'; export default connect((state) => ({ projectKey: state.getIn(['site', 'instance', 'projectKey'])}) )(NgRxDoc)