Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-export

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-export

Minimal Gear using Redux to develop modularized applications.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Redux Export

Export module Redux bootstrap.

What is Redux Export?

Minimal Gear using Redux to develop modularized applications.

Getting started

Install

yarn add redux-export

Basic Usage

const MY_ACTION = 'MY_ACTION_CONST'

const reducer = {  
  [MY_ACTION]: (state, {payload}) => ({
    ...state,
    foo: payload
  })
}

const middleware = {  
  [MY_ACTION]: (store, next, action) => {
    const state = store.getState();
    console.log(`passing ${MY_ACTION} with state`, {...state})
    return next(action)
  }
}

const initialState = {foo: 'HERE'}
const MyModuleFoo = {reducer, middleware, initialState}

export default MyModuleFoo
const OTHER_ACTION = 'OTHER_ACTION_CONST'

const reducer = (state, {payload}) => ({
  ...state,
  bar: payload
})

const middleware = store => next => action => {
  if (action.type !== OTHER_ACTION) return next(action)

  const state = store.getState();
  console.log(`passing ${OTHER_ACTION} with state`, {...state})
  return next(action)
}

const initialState = {bar: 'other'}
const MyModuleBar = {reducer, middleware, initialState}

export default MyModuleBar
import React from 'react'
import {render} from 'react-dom'
import reduxExport from 'redux-export'
import MyModuleFoo from './MyModuleFoo'
import MyModuleBar from './MyModuleBar'

const store = reduxExport([MyModuleFoo, MyModuleBar])
const divRender = document.getElementById('devRender')

store.subscribe(() => {
  const state = store.getState()
  const {foo, bar} = state
  console.log({foo, bar})
})

render(
  <Provider store={store}>
    <App />
  </Provider>, divRender
)

FAQs

Package last updated on 07 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc