Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
amos-redux
Advanced tools
`amos-redux` allows you to use `amos` and `redux` at the same time without modifying your redux business.
amos-redux
allows you to use amos
and redux
at the same time without modifying your redux business.
amos
' store.select()
(you can use it with amos
' useSelector()
in react
function components) to select both amos
' and redux
's state at the same time, and use amos
'
store.dispatch()
(you can get it by amos
' useDispatch()
in react function components) to
dispatch both amos
' dispatchable things and redux
's actions.amos
's outstanding features: selector caches
and transactions
, you can get more
detailed information about tis in Quick start
's example.yarn add amos-redux
# or var npm
npm i -S amos-redux
You can get a full online demo here:
The following code is the simplified:
import { createStore as createReduxStore } from 'redux';
import { Provider as ReduxProvider } from 'react-redux';
import {
createStore as createAmosStore,
Provider as AmosProvider,
useSelector,
useDispatch,
} from 'amos';
import { withRedux } from 'amos-redux';
const reduxStore = createReduxStore(rootReducer);
const amosStore = createAmosStore(void 0, withRedux(reduxStore) /* hybrid redux store */);
ReactDOM.render(
<ReduxProvider store={reduxStore}>
<AmosProvider store={amosStore}>
<MyApp />
</AmosProvider>
</ReduxProvider>,
document.querySelector('#root'),
);
function MyApp() {
const [amosState, reduxState] = useSelector(
selectSomeAmosState,
selectSomeReduxState /* select redux's state with amos' useSelector */,
);
const dispatch = useDispatch();
const handleAmosClick = () => dispatch(someAmosAction());
const handleReduxClick = () => dispatch(someReduxAction()); // dispatch redux's action with amos' dispatch
return (
<div>
<div>
<span>Amos state: {amosState} </span>
<button onClick={handleAmosClick}>click me</button>
</div>
<div>
<span>Redux state: {reduxState} </span>
<button onClick={handleReduxClick}>click me</button>
</div>
</div>
);
}
import { Store } from 'redux';
import { StoreEnhancer } from 'amos';
function withRedux(reduxStore: Store): StoreEnhancer;
Parameters
reduxStore
: the redux store you injected into your projectReturns
A StoreEnhancer
which is used for amos createStore()
.
The MIT License (MIT)
Copyright (c) 2020 acrazing
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
FAQs
`amos-redux` allows you to use `amos` and `redux` at the same time without modifying your redux business.
The npm package amos-redux receives a total of 7 weekly downloads. As such, amos-redux popularity was classified as not popular.
We found that amos-redux 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.