Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
redux-module
Advanced tools
Reduced boilerplate for your redux, inspired from Ducks: Redux Reducer Bundles and personally felt the pain of writing too much boilerplate for simple redux apps.
// sideNav.js
// Simple module that is suppose to open and close SideNavigation (hamburger menu) of an app.
import reduxModule from 'redux-module';
const module = reduxModule({
initialState: {
isSideNavOpen: false
},
reducers: {
openSideNav: (state) => ({ ...state, isSideNavOpen: true }),
closeSideNav: (state) => ({ ...state, isSideNavOpen: false })
}
});
export default module;
import { combineReducers } from 'redux';
import { getReducersFromModules } from 'redux-module';
import * as allModules from '/modules/index';
export default combineReducers(getReducersFromModules(allModules));
import { getReducerFromModule } from 'redux-module';
const reducer = getReducerFromModule(allModules);
import { connect } from 'react-redux';
import { actions } from 'mobile/modules/appState';
@connect(state => ({ appState: state.appState }))
class App extends Component {
render() {
const { appState, dispatch } = this.props;
return (
<div>
<button onClick={() => dispatch({type: actions.openSideNav})} >Open SideNav</button>
<SideNavigation isSideNavOpen={appState.isSideNavOpen} />
</div>
);
}
}
Redux Modules auto generates mirrored key value actions based on function names provided in reducers
object when creating Redux Module.
For above reducer you will have following actions available,
import { actions } from 'mobile/modules/appState';
console.log(actions); //{ openSideNav: 'openSideNav', closeSideNav: 'closeSideNav' }
You can now use these actions in your usual way ie,
import { actions } from 'mobile/modules/appState';
// somewhere in the component
dispatch({type: actions.openSideNav})
FAQs
Reduced boilerplate for redux
The npm package redux-module receives a total of 0 weekly downloads. As such, redux-module popularity was classified as not popular.
We found that redux-module 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
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.