
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
oberon-redux
Advanced tools
Update your redux state directly from your components. No reducers, no actions.
Update your state directly from your components. No reducers, no actions.
npm i oberon-redux
or
yarn add oberon-redux
This package is designed to provide an interface to using redux that matches the development thought proces. When using redux, generally you need to define your default state, provide reducers to define how your state can get updated and then create an interface to trigger these updates through action creators. We feel it makes more sense to focus on creating components and use the redux state whenever you need to share state between components or component instances (i.e. through persistence). Doing this should not break your workflow or thought process. Therefor with this package, all you need to do to use your redux store is the following:
Updater functions are provided that implement common state update patterns.
For an overview of all available updater functions, refer to the full API documentation
// The default state us just a plain object
export default {
currentIndex: 0,
};
You can add the reducer as the root reducer when creating your store, but we recommend using combine reducers so you have the option to add other redux related packages, for example to manage your api calls and data.
import { createReducer } from 'oberon-redux';
import defaultState from './defaultState';
const reducer = createReducer(defaultState, 'app');
const rootReducer = combineReducers({app: reducer});
const store = createStore(rootReducer, composeEnhancers(applyMiddleware(thunk)));
import React from 'react';
import { connect } from 'react-redux';
import { update } from 'oberon-redux';
// Use react-redux to bind your state and dispatch updates.
const mapStateToProps = state => ({
currentIndex: state.app.currentIndex,
});
const mapDispatchToProps = dispatch => ({
updateIndex: index => dispatch(update('app.currentIndex', index))
});
const enhance = connect(mapStateToProps, mapDispatchToProps);
const MyComponent = props => (
<div>
<div>The current index is {props.currentIndex}</div>
<div>
{[0, 1, 2, 3].map(index =>
<button key={index} onClick={() => props.updateIndex(index)}>{index}</button>
)}
</div>
</div>
);
export default enhance(MyComponent);
This package includes TypeScript type definitions. So type checking on all functions should be enabled by default. To add type checking on the path names given to updater functions, you can use the createStatePaths function to retrieve a StatePathTree. This is a recursive structure that you can use instead of strings when passing the state path to an updater function.
import { createStatePaths } from 'oberon-redux';
export const paths = createStatePaths(defaultState, 'app');
// somewhere in your component
dispatch(update(paths.currentIndex, 3));
// is same as
dispatch(update('app.currentIndex', 3));
// but with type checking. Catch errors before they happen!
FAQs
Update your redux state directly from your components. No reducers, no actions.
We found that oberon-redux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.