Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
redux-reverb
Advanced tools
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { applyMiddleware, compose, createStore } from 'redux';
import { Provider } from 'react-redux';
import promise from 'redux-promise-middleware';
import thunk from 'redux-thunk';
import sideEffectCreator from 'redux-reverb';
import rootSideEffect from 'sideEffects';
import reducers from 'state';
import App from './App';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const sideEffectMiddleware = sideEffectCreator(rootSideEffect);
const store = createStore(reducers, composeEnhancers(applyMiddleware(thunk, promise, sideEffectMiddleware)));
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root'),
);
sideEffects/index.js
import throttle from 'lodash/throttle';
import { SideEffect } from 'redux-reverb/lib/types';
const rootSideEffect: SideEffect = (action, previousState, currentState, dispatch) => {
notificationSideEffect(action, previousState, currentState, dispatch);
observeFirstName(action, previousState, currentState, dispatch);
};
export default rootSideEffect;
const notificationSideEffect: SideEffect = (action, previousState, currentState, dispatch) => {
if (action.type === 'SET_FIRST_NAME_FULFILLED') dispatchNotification('First name successfully set', dispatch);
};
const dispatchNotification = (notificationText, dispatch) => {
dispatch({
type: 'PUSH_NOTIFICATION',
payload: notificationText,
});
setTimeout(() => {
dispatch({
type: 'POP_NOTIFICATION',
});
}, 3000);
};
const throttledDispatchNotification = throttle((notificationText, dispatch) => {
dispatch({
type: 'PUSH_NOTIFICATION',
payload: notificationText,
});
setTimeout(() => {
dispatch({
type: 'POP_NOTIFICATION',
});
}, 3000);
}, 2000);
const observeFirstName: SideEffect = (action, previousState, currentState, dispatch) => {
if (previousState.user.firstName === null && currentState.user.firstName !== null) {
console.log('user field was populated');
}
};
FAQs
Dead simple side-effect management for redux.
We found that redux-reverb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.