How to use the redux-thunk.default function in redux-thunk

To help you get started, we’ve selected a few redux-thunk 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 davidkpiano / react-redux-form / test / field-component-spec.js View on Github external
+ ' represented by the model', (done) => {
      const initialState = {
        foo: [
          { val: 1 },
          { val: 2 },
          { val: 3 },
        ],
      };

      /* eslint-disable global-require */
      const store = createTestStore(createStore(combineReducers({
        form: formReducer('test', initialState),
        test: modelReducer('test', initialState),
      }), applyMiddleware(require('redux-thunk').default)), done);
      /* eslint-enable */

      const index = 1;
      TestUtils.renderIntoDocument(
        
          <div>
            
              <div>
                <label>
                <input>
              </label></div>
            
            
              <div>
                <label>
                <input></label></div></div>
github terotests / ts2redux / dist / src / frontend / main.js View on Github external
var reducers_1 = require("./models/reducers/");
var TodoList_1 = require("./models/reducers/TodoList");
var UserState_1 = require("./models/reducers/UserState");
var IncModel_1 = require("./models/reducers/IncModel");
var GenericComp_1 = require("./components/GenericComp");
var memberArea_1 = require("./components/memberArea");
var todoList_1 = require("./components/todoList");
var ReduxInc_1 = require("./components/ReduxInc");
var combinedState_1 = require("./components/combinedState");
var todo = require("./models/TodoList");
var WaspModel_1 = require("./models/reducers/WaspModel");
var WaspComponent_1 = require("./components/WaspComponent");
var TetrisComponent_1 = require("./components/TetrisComponent");
var WaspContextComponent_1 = require("./components/WaspContextComponent");
var UIHelperModel_1 = require("./models/reducers/UIHelperModel");
var store = redux_1.createStore(reducers_1.reducers, redux_1.compose(redux_1.applyMiddleware(redux_thunk_1.default), window["__REDUX_DEVTOOLS_EXTENSION__"]
    ? window["__REDUX_DEVTOOLS_EXTENSION__"]()
    : function (f) { return f; }));
// Testing...
var TodoStoreController = /** @class */ (function () {
    function TodoStoreController(store) {
        this._store = store;
    }
    Object.defineProperty(TodoStoreController.prototype, "items", {
        set: function (value) {
            this._store.dispatch({
                type: TodoList_1.TodoListEnums.TodoList_items,
                payload: value
            });
        },
        enumerable: true,
        configurable: true
github wonderunit / storyboarder / src / js / windows / shot-generator / window.js View on Github external
const React = require('react')
const { useRef } = React
const { Provider, connect } = require('react-redux')
const ReactDOM = require('react-dom')
const { ActionCreators } = require('redux-undo')
console.clear() // clear the annoying dev tools warning
const log = require('electron-log')
log.catchErrors()



// TODO use the main Storyboarder store instead of a special one for Shot Generator
//
// configureStore:
const { createStore, applyMiddleware, compose } = require('redux')
const thunkMiddleware = require('redux-thunk').default
const undoable = require('redux-undo').default
const { reducer } = require('../../shared/reducers/shot-generator')

const actionSanitizer = action =&gt; (
  action.type === 'ATTACHMENTS_SUCCESS' &amp;&amp; action.payload ?
  { ...action, payload: { ...action.payload, value: '&lt;<data>&gt;' } } : action
)
const stateSanitizer = state =&gt; state.attachments ? { ...state, attachments: '&lt;&gt;' } : state
const reduxDevtoolsExtensionOptions = {
  actionSanitizer,
  stateSanitizer
}
const composeEnhancers = (
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &amp;&amp;
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__(reduxDevtoolsExtensionOptions)
  ) || compose</data>
github frictionlessdata / datapackage-ui / src / render.js View on Github external
const React = require('react')
const ReactDOM = require('react-dom')
const thunk = require('redux-thunk').default
const {createStore, applyMiddleware} = require('redux')
const {Provider} = require('react-redux')


// Module API

/**
 * Render component
 *
 * @param {Component} component - it could be one of provided by the library component
 * @param {Object} props - object containing props
 * @param {Element} element - DOM element to render into
 */
function render(Component, props, element) {

  // Prepare component
github brave / ethereum-remote-client / test / lib / mock-store.js View on Github external
const createStore = require('redux').createStore
const applyMiddleware = require('redux').applyMiddleware
const thunkMiddleware = require('redux-thunk').default
const createLogger = require('redux-logger').createLogger
const rootReducer = function () {}

module.exports = configureStore

const loggerMiddleware = createLogger()

const createStoreWithMiddleware = applyMiddleware(
  thunkMiddleware,
  loggerMiddleware
)(createStore)

function configureStore (initialState) {
  return createStoreWithMiddleware(rootReducer, initialState)
}
github ember-redux / ember-redux / app / middleware / index.js View on Github external
import thunk from 'redux-thunk';

var resolved = thunk.default ? thunk.default : thunk;

export default [ resolved ];
github bzurkow / 3D_Tron / server / store.js View on Github external
const { createStore, applyMiddleware, combineReducers } = require('redux');
const thunkMiddleware = require('redux-thunk').default;

const { userReducer } = require('./reducers/users');

const rootReducer = combineReducers({
  users: userReducer
});

const store = createStore(
  rootReducer,
  applyMiddleware(thunkMiddleware)
);

module.exports = store;
github jackfranklin / react-training-workshop / exercises / es2015-react / src / app.js View on Github external
var React = require('react');
var ReactDOM = require('react-dom');

var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Link = ReactRouter.Link;
var IndexLink = ReactRouter.IndexLink;
var IndexRoute = ReactRouter.IndexRoute;
var hashHistory = ReactRouter.hashHistory;

var Redux = require('redux');
var reduxThunk = require('redux-thunk').default;
var reducers = require('./reducers');
var Provider = require('react-redux').Provider;

var devTools = window.devToolsExtension ?
  window.devToolsExtension() : function(x) { return x }

var store = Redux.createStore(
  reducers,
  {},
  Redux.compose(
    Redux.applyMiddleware(reduxThunk),
    devTools
  )
);
github service-bot / servicebot / config / redux / store.js View on Github external
let NotificationTemplate = require("../../models/notification-template");
let thunk = require('redux-thunk').default;
let sagaMiddleware = require("./saga");
let { call, put, takeEvery } = require('redux-saga/effects')
let { delay } = require('redux-saga')
let Settings =  require('../../models/system-options');

let { createStore, applyMiddleware, combineReducers } = require('redux');


let { EVENT, SET_OPTIONS,SET_EVENT_SAGAS, INIT_STORE, setOptions ,setEventSagas, initializeStore, triggerEvent}  =  require("./actions");
const defaultAppState = {
    "eventReducer" : null,
    "eventSagas" : {},
    "options" : {}
};
//todo: store sagas in store
function appReducer(state = defaultAppState , action) {
github StarshipAcademy / StarshipAcademy / server / redux / store.js View on Github external
const {createStore, applyMiddleware, combineReducers} = require('redux');
const thunkMiddleware = require('redux-thunk').default;

const {userReducer} = require('./reducers/user-reducer');
const {bulletReducer} = require('./reducers/bullet-reducer');
const {asteroidReducer} = require('./reducers/asteroid-reducer');


const rootReducer = combineReducers({
  users: userReducer,
  bullets: bulletReducer,
  asteroids: asteroidReducer,
});

const store = createStore(
  rootReducer,
  applyMiddleware(thunkMiddleware)
);

redux-thunk

Thunk middleware for Redux.

MIT
Latest version published 1 year ago

Package Health Score

84 / 100
Full package analysis