How to use the react-sweet-state.defaults.devtools function in react-sweet-state

To help you get started, we’ve selected a few react-sweet-state examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atlassian / react-sweet-state / examples / advanced-flow / index.js View on Github external
/**
 * Add simple logger middleware
 */
const mw: Middleware = storeState => next => arg => {
  /* eslint-disable no-console */
  console.log(storeState.key, 'changing', arg);
  const result = next(arg);
  console.log(storeState.key, 'changed');
  return result;
};
defaults.middlewares.add(mw);
/**
 * Enable Redux devtools support
 */
defaults.devtools = true;

/**
 * Main App
 */
class App extends Component<{}> {
  render() {
    return (
      <div>
        <h1>User Todos example</h1>
        <main>
          <div>
            <h3>With Render-props</h3>
            
            
          </div>
          <hr></main></div>
github atlassian / react-sweet-state / examples / advanced-scoped-flow / index.js View on Github external
// @flow
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { defaults } from 'react-sweet-state';

import '@babel/polyfill';

import { ChatRpc } from './views/chat-rpc';
import { ChatHook } from './views/chat-hook';
/**
 * Enable Redux devtools support
 */
defaults.devtools = true;

/**
 * Main App
 */
class App extends Component&lt;
  {},
  { reset: number, remount: number, remoteUsers: number }
&gt; {
  state = {
    reset: 0,
    remount: 0,
    remoteUsers: 20,
  };

  reset = () =&gt; {
    const reset = this.state.reset + 2;

react-sweet-state

Global + local state combining the best of Redux and Context API

MIT
Latest version published 3 months ago

Package Health Score

82 / 100
Full package analysis