Code Monkey home page Code Monkey logo

redux-devtools-diff-monitor's Introduction

Redux DevTools โ€“ Diff Monitor

This project provides an alternate monitor for Redux DevTools. The primary goal of this monitor is to highlight the changes to an application's state from action to action. This tool includes the main features from the default DevTools monitor (rollback, commit, reset and individual action toggles).

Imgur

As with the Redux DevTools, this project is a developer tool and is not intended for use in production.

Installation Example

Install from npm:

npm install --save-dev redux-devtools-diff-monitor

Render Devtools and pass this monitor as a prop, e.g. <DevTools store={store} monitor={DiffMonitor} />.

import React, { Component } from 'react';
import TodoApp from './TodoApp';
import { createStore, combineReducers, compose } from 'redux';
import { devTools, persistState } from 'redux-devtools';
import { DevTools, DebugPanel } from 'redux-devtools/lib/react';

import DiffMonitor from 'redux-devtools-diff-monitor';

import { Provider } from 'react-redux';
import * as reducers from '../reducers';

const finalCreateStore = compose(
  devTools(),
  persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(createStore);

const reducer = combineReducers(reducers);
const store = finalCreateStore(reducer);

export default class App extends Component {
  render() {
    return (
      <div>
        <Provider store={store}>
          {() => <TodoApp /> }
        </Provider>
        <DevTools store={store} monitor={DiffMonitor} />
    </div>
    );
  }
}

Usage

  • When included as a DevTools monitor, use Ctrl+] or Ctrl+H to toggle visibility of the frame.
  • New actions appear at the top of the monitor as they occur.
  • Actions will be minimized by default; actions shown in green are causing a state mutation.
  • Click an action name to expand its pane to view the state mutations the action caused.
  • Click "disable" next to any action name to ignore that action and roll back the state mutations that action caused.
  • As in the default Redux DevTools, click 'Commit' to reset the monitor and set the current app state as the rollback point. If you click rollback after clicking commit, actions will be replayed through the commit point.

The TodoMVC example from the Redux Devtools project is included in ./examples/todomvc. To build and view locally:

  1. Run npm install from the project root
  2. cd to ./examples/todomvc
  3. Run npm install
  4. Run npm start to run the app on port 3000 at localhost.

redux-devtools-diff-monitor's People

Contributors

iktl avatar thesmaw avatar damassi avatar alesch avatar

Stargazers

Michael Anthony avatar

Watchers

Michael Anthony avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.