Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@zackdk/reduxtool
Advanced tools
简化redux的模版代码。对比rematch,无侵入性。可正常使用所有中间件。 使用见 example 文件夹。 或者参考该项目 风影院
npm install -S @zackdk/reduxtool
或者可以直接复制dist/reduxtool.js或者src/index.js到项目里。
export default {
state : {
author : "nothing",
title : "nothing",
content : "nothing"
},
reducers: {
changeTitle(state, payload) {
return {...state,title:payload}
},
changeAuthor(state, payload) {
return {...state,author:payload}
},
changeContent(state, payload) {
return {...state,content:payload}
},
},
effects: {
async changeTitleAsync(payload) {
await new Promise(resolve => setTimeout(resolve, 1000))
this.changeTitle(payload)
}
}
}
import { createStore } from 'redux';
import ReduxTool from '../../../dist/reduxtool';
//或者
//import ReduxTool from '@zackdk/reduxtool';
import page from "./models/page";
import list from "./models/list";
const models = {
page,list
};
//createReducer的结果为reducer
const store = createStore(ReduxTool.createReducer(models));
//给dispatch注入方法,没有找到更好的办法😢
//注入store,是为了effects执行时,获取当前state。
ReduxTool.ejectDispatch(store);
export default store;
store.dispatch.list.changeList([1,2,2,2,2,2]);
store.dispatch.page.changeTitleAsync("这是一条异步的title");
// 当你和redux-react一起使用时
const mapDispatch = dispatch => ({
increment: () => dispatch.page.changeTitleAsync(),
})
// 或者使用解构
const mapDispatchWithDestructure = ({ page: { changeTitleAsync } }) => {
return {
changeTitleAsync
}
}
FAQs
simplelify the redux
The npm package @zackdk/reduxtool receives a total of 0 weekly downloads. As such, @zackdk/reduxtool popularity was classified as not popular.
We found that @zackdk/reduxtool 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.