Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
redux helper tool to abstract action and reducer with getDefaultState and updaters.
redux-prim builds an abstract layer on top of redux, making state management as it should be:
getDefaultState
updaters
and namespacing
The actions and reducers are greatly weaken, while under the abstraction layer, everything stays the same:
This abstraction is more in line with the human brain's understanding of the data, and supports custom updater to achieve code reuse. Redux-prim also provides interfaces for data contract design.
npm i redux-prim
Create a todo slice
import createSlice from 'redux-prim';
const {actions, reducer, selector} = createSlice('todo',
()=>({ visible: false }),
({ setState }) => {
return {
setTodoVisibility(todoVisible) {
return setState({ todoVisible });
}
}
});
combine reducers
import { combineReducers } from 'redux';
import { userReducer } from './userSlice';
import { appReducer } from './appSlice';
export default combineReducers({
...userReducer,
...appReducer
});
use slice
import React, { useCallback } from 'react';
import todoSlice from './store/todoSlice';
import { useSelector, useDispatch } from 'react-redux';
const { actions, selector } = todoSlice;
function App() {
const todo = useSelector(selector);
const dispatch = useDispatch();
const showTodo = useCallback(() => dispatch(actions.setTodoVisibility(true)), []);
return (
<div>
{todo.visible ? <div>this is todo</div> : <button onClick={showTodo}>show todo</button>}
</div>
)
}
FAQs
redux helper tool to abstract action and reducer with getDefaultState and updaters.
The npm package redux-prim receives a total of 2 weekly downloads. As such, redux-prim popularity was classified as not popular.
We found that redux-prim 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.