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

dynamic-redux

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-redux

With dynamic redux you can inject your reducers on the fly

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Dynamic redux

With dynamic redux you can inject your reducers on the fly

Installation


nikandlv@nikandlv.ir:~$ npm install redux react-redux redux-thunk

Then simply copy Data folder into your project

Setup

Import it

import ReduxProvider from './Data/ReduxProvider'

Wrap your root component or any base component

ReactDOM.render(
    <ReduxProvider>
        <Application />
    </ReduxProvider>, document.getElementById('root'));

Injecting a reducer

Import the store and a reducer

import CounterReducer from './Data/Reducers/CounterReducer'
import Store from './Data/Store'

Inject your reducer

Store.injectReducer('CounterReducer',CounterReducer)

injectReducer takes two parameters a key and the reducer

Use withDynamic builder

using withDynamic builder you can easily access your reducers and actions in your components

import withDynamic from './Data/withDynamic';

export default withDynamic(MyComponent)
                .injectAction('name', func)
                .injectReducer('CounterReducer')
                .build()

there are 2 main functions

injectAction which takes function name and the action and injects it into your component props

injectReducer which takes a reducer name and injcets it into your component props

Keywords

FAQs

Package last updated on 29 Sep 2019

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