
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
novux
lets you to write simpler reduce Redux code with less boilerplate. Novux uses a simple but opinionated reducer generator that handles logic for 2 actions: update and reset.
novux
helps us write faster and better redux logic:
update
or reset
.npm install novux
npm run build
npm run test
import createReducer from 'novux';
const initialStates = {
user: {
name: 'Michael',
company: 'Nova Credit'
},
};
const userReducer = createReducer('user', initialStates.user);
novux
lets you run Redux by handling only two actions: update
and reset
.
update
is used to update the state of a single reducer given an object.
reset
is used to reset the reducer to its initial state or reset specific keys to their initial values.
Both actions have the following signature:
actionName(reducerName, tag, options)
Example:
import { update, reset } from 'novux';
dispatch(update('user', 'Change username', {
username: 'Stash',
}));
dispatch(reset('user', 'Reset the initial state', {
reset: [],
}));
dispatch(reset('user', 'Reset specific keys', {
reset: ['username'],
}));
// dispatch is provided by redux: http://redux.js.org/docs/api/Store.html#dispatchaction
When reseting state, you can also pass in paths in dot notation
dispatch(reset('user', 'Reset paths', {
reset: ['address.street'],
}));
// if a path is defined in the initial state, it will be reset to its initial value
// if a path is undefined in the initial state, `novux` will seek the longest sub path defined in the initial state and reset
Using the tag
string instead of an action name to define a state change lets you describe state changes programatically.
The tag is included in the updated state under the key _lastAction
, allowing you to keep track of what action last affected a specific reducer in your dev tools.
const consent = true;
const { username } = getState().user;
dispatch(update('user', `${username} ${consent ? 'grants' : 'revokes'} consent`, {
consent,
}));
novux
can help you declare increasingly complicated sets of state updates in simple and consistent ways.
const toggleConsent = consent => (dispatch, getState) => {
const { username } = getState().user;
dispatch(update('user', `${username} ${consent ? 'grants' : 'revokes'} consent`, {
consent,
}));
if (!consent) {
dispatch(update('app', `Show error & disable button`, {
error: {
msg: 'You need to grant consent to proceed',
type: 'flash',
},
button: { able: false }
}));
}
};
// this example makes use of redux-thunk to easily access dispatch and state
FAQs
Easily update & reset redux state
The npm package novux receives a total of 624 weekly downloads. As such, novux popularity was classified as not popular.
We found that novux 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
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.