How to use the redux.createRedux function in redux

To help you get started, we’ve selected a few redux 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 google-map-react / old-examples / web / flux / init_redux.js View on Github external
const isServerCall = serverPath !== undefined && serverPath !== null;
    const routePathes = pick(userRoutesActions, isString);
    const initialRouteDispatch = !initialState || isServerCall; // call or not initial route

    // Create a Dispatcher function for your composite Store:
    const dispatcher = createDispatcher(
      store,
      getState => [
        thunkMiddleware(getState),
        multiActionMiddleware({wait: isServerCall}), // wait multiple actions to complete or not
        promiseMiddleware(),
        callFnMiddleware(action => (action && action.type === SWITCH_LINK && gotoRoute(action.url))) // helper for  component
      ]
    );

    const redux = createRedux(dispatcher, initialState);

    // bind route changes on changeRoute action
    router(routePathes, initialRouteDispatch, (...args) => {
      const dispatchResult = redux.dispatch(userRoutesActions.changeRoute(...args));
      // resolve on server after all actions in userRoutesActions.changeRoute resolved
      if (isServerCall) {
        if (!dispatchResult || !isFunction(dispatchResult.then)) {
          reject(new Error('dispatchResult must be promise on server'));
        }

        if (dispatchResult && isFunction(dispatchResult.then)) {
          dispatchResult.then(
            () => resolve(redux), // result is'n needed it's just to be sure all actions done
            err => reject(err)
          );
        }
github edf-hpc / slurm-web / frontend / src / Root.js View on Github external
const {
  Application,
  Login,
  Jobs,
  Racks,
  JobsMap,
  Partitions,
  QOS,
  Reservations
} = components
const dispatcher = createDispatcher(
  composeStores(stores),
  getState => [ thunkMiddleware(getState), loggerMiddleware ]
)
const redux = createRedux(dispatcher)

export default class Root extends React.Component {

  static propTypes = {
    history: PropTypes.object.isRequired
  }

  constructor () {
    super()
  }

  renderRoutes (history) {
    let router = (
github insin / react-lessons / src / containers / App.js View on Github external
var React = require('react')
var {Redirect, Router, Route} = require('react-router')
var {createRedux} = require('redux')
var {Provider} = require('redux/react')

var LessonsApp = require('./LessonsApp')
var stores = require('../stores/index')

var redux = createRedux(stores)

var App = React.createClass({
  render() {
    var {history} = this.props
    return 
      {renderRoutes.bind(null, history)}
    
  }
})

function renderRoutes(history) {
  return 
    
    
  
}
github kmees / universal-react-on-azure / src / createRedux.js View on Github external
export default function(initialState = {}) {
  return createRedux(dispatcher, initialState)
}
github raineroviir / react-redux-socketio-chat / client / js / containers / App.js View on Github external
import React from 'react';
import { createRedux } from 'redux';
import { Provider } from 'redux/react';
import * as stores from '../stores';
import ChatApp from './ChatApp';
const redux = createRedux(stores);


export default class App {
  render() {
    return (
      
        {() => }
      
    );
  }
}
github ironbay / react-redux-template / app / components / routes.jsx View on Github external
import Example from "actions/example"
import React from "react"
import Router, { Route, Redirect } from 'react-router'
import App from 'app'

import { createRedux } from 'redux';
import Provider from "redux/react"
import * as stores from "stores"
const redux = createRedux(stores);

var routes = (
	
	
)

React.initializeTouchEvents(true)
Router.run(routes, Router.HistoryLocation, (Handler) => {
	React.render(, document.body)   
})
github khtdr / redux-react-koa-isomorphic-counter-example / src / shared / redux.js View on Github external
export default function create(stores, initialState) {
  const store = composeStores(stores);
  const dispatcher = createDispatcher(store, () => [middleware()]);
  return createRedux(dispatcher, initialState);
}
github andrew-codes / community-board / src / server / RenderRoute.js View on Github external
function renderRoute(routerState, transition) {
	const redux = createRedux(dispatcher, {});
	var bundleScriptSrc = 'assets/bundle.js';
	var appScriptSrc = config.isProduction ? bundleScriptSrc : `${config.webpackDevUrl}/${bundleScriptSrc}`;
	return Promise.all(RouteToInitialData(redux, routerState))
		.then(()=> {
			var appHtml = React.renderToString();
			var scriptsHtml = `
		        
		        
            `;
			var title = 'A Title';
			return buildHtmlPage(scriptsHtml, appHtml, title);
		});
}
github raineroviir / react-redux-socketio-chat / client / js / redux / create.js View on Github external
export default function(client, data) {
  const dispatcher = createDispatcher(
    store,
      getState => [middleware(client)]
  );

  return createRedux(dispatcher, data);
}
github kelvinr / React-Todo / frontend / js / Root.js View on Github external
import { loadLists } from './actions/listActions';
import * as components from './components';
import * as stores from './reducers';

import injectTapEventPlugin from 'react-tap-event-plugin';
import mui from 'material-ui'
let ThemeManager = new mui.Styles.ThemeManager();
ThemeManager.setTheme(ThemeManager.types.LIGHT);

const {
  Application,
  ListsView,
  ListView
} = components;

const redux = createRedux(stores);
redux.dispatch(loadLists());
injectTapEventPlugin();

export default class Root extends React.Component {

  static propTypes = {
    history: PropTypes.object.isRequired
  }

  getChildContext() {
    return {
      muiTheme: ThemeManager.getCurrentTheme()
    };
  }

  render() {