- Notifications
You must be signed in to change notification settings - Fork4
Dispatch your actions manually to test if your app reacts well.
License
YoruNoHikage/redux-devtools-dispatch
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Dispatch your actions manually to test if your app reacts well.
npm install --save-dev redux-devtools-dispatch
You can declare your Dispatcher the same way you declare a Monitor in your Dev Tools.
importReactfrom'react';import{createDevTools}from'redux-devtools';importDispatcherfrom'redux-devtools-dispatch';exportdefaultcreateDevTools(<Dispatcher/>);
You can inject action creators to ease the process of testing your app firing yourself actions.
importReactfrom'react';import{createDevTools}from'redux-devtools';importDispatcherfrom'redux-devtools-dispatch';constactionCreators={increment(){return{type:'INCREMENT_COUNTER'};},decrement(){return{type:'DECREMENT_COUNTER'};},nested:{worksToo(){return{type:'NESTED_WORKS_TOO',cool:true};},},};exportdefaultcreateDevTools(<DispatcheractionCreators={actionCreators}/>);
You can also use<MultipleMonitors> fromredux-devtools-multiple-monitors to use multiple monitors into the<DockMonitor>:
importReactfrom'react';import{createDevTools}from'redux-devtools';importLogMonitorfrom'redux-devtools-log-monitor';importDockMonitorfrom'redux-devtools-dock-monitor';importDispatcherfrom'redux-devtools-dispatch';importMultipleMonitorsfrom'redux-devtools-multiple-monitors';exportdefaultcreateDevTools(<DockMonitortoggleVisibilityKey="ctrl-h"changePositionKey="ctrl-q"defaultIsVisible={false}><MultipleMonitors><LogMonitor/><Dispatcher/></MultipleMonitors></DockMonitor>);
Then, just write an JSON action in the field, click on Dispatch, and that's all!
| Name | Description |
|---|---|
theme | Same as in LogMonitor's package Either a string referring to one of the themes provided byredux-devtools-themes (feel free to contribute!) or a custom object of the same format. Optional. By default, set to'nicinabox'. |
initEmpty | Whentrue, the dispatcher is empty. By default, set tofalse, the dispatcher contains :{ "type": "" }. |
actionCreators | Either a array of action creators or an object containing action creators. When defined, a selector appears to choose the action creator you want to fire, you can fill up the arguments and dispatch the action. |
dispatchFn | Function to be called for dispatching actions. By default it is using component'sthis.context.store.dispatch. |
As this package is my first, any comment, pull request, issue is welcome so I can learn more from everyone.
MIT
About
Dispatch your actions manually to test if your app reacts well.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.
