JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 536
  • Score
    100M100P100Q8580F
  • License MIT

Debug your Unstated containers with ease

Package Exports

  • unstated-debug

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unstated-debug) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

unstated-debug Build Status

Debug your Unstated containers with ease


Install

$ npm install unstated-debug

Setup

In the root of your app, import unstated-debug:

import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'unstated';
import UNSTATED from 'unstated-debug';
import App from './components/App';

UNSTATED.logStateChanges = false;

render(
    <Provider>
        <App/>
    </Provider>,
    document.querySelector('#root')
);

Usage

When enabled, it exposes a global object UNSTATED which you can use in DevTools to explore the containers and their state.

The object contains the following properties:

  • isEnabled - Same as the below option, but you can change it after init.
  • logStateChanges - Same as the below option, but you can change it after init.
  • isCollapsed - Collapse logs by default.
  • containers - Your containers.
  • states - The state objects of your containers.
  • logState() - Logs the current state of your containers.

API

UNSTATED

isEnabled

Type: boolean
Default: true

Toggle debugging.

For example, if you use this in an Electron app, you could pass it is.development to ensure debugging is disabled in production.

logStateChanges

Type: boolean
Default: true

Logs a diff for each state change to the containers. This gives you a live insight into state changes in your app.

License

MIT © Sindre Sorhus