Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@uirouter/redux
Advanced tools
Keep UI-Router and Redux state in sync.
UI-Router works well combined with Redux.
You just need to connect()
your routed components and they can access the application state as you would expect, as well as dispatch actions.
But you might want to do some more advanced stuff, like leveraging router transitions as actions for your reducers, or trigger router transitions via redux actions.
What you can do with this library:
The library exposes a core UI-Router plugin
, a reducer
, a middleware
and an action creator
.
The core is framework agnostic, works directly with Redux and UI-Router and can be used anywhere.
It also exposes framework specific components to help integrate better the plugin in your applications. The current framework implementations are:
Depending on the framework you're using, the initial boilerplate may differ a bit.
The package is publish on the npm
repository and can be installed using yarn
or npm
.
yarn add @uirouter/redux
import { pushStateLocationPlugin, UIRouterReact, UIView } from '@uirouter/react';
import { createRouterMiddleware, routerReducer } from '@uirouter/redux';
import { ConnectedUIRouter } from '@uirouter/redux/lib/react';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { Provider } from 'react-redux';
// Instantiate the Router
const router = new UIRouterReact();
// Create the Redux middleware by passing it
const routerMiddleware = createRouterMiddleware(router);
// Create the Redux reducer
const reducer = combineReducers({
// ... your reducers
router: routerReducer,
});
// And finally create the Redux store
const store = createStore(reducer, applyMiddleware(routerMiddleware));
// Use the ConnectedUIRouter component and pass it the
// router instance. It will get the Redux store from
// the React Context and apply the plugin for you
const app = (
<Provider store={store}>
<ConnectedUIRouter
router={router}
plugins={[pushStateLocationPlugin]}
states={states}
>
<UIView />
</ConnectedUIRouter>
</Provider>
);
Clone the library and install the dependencies with npm install
or yarn
.
You can run the React example with yarn start
but you need to go into examples/react
and install the dependencies there as well.
To build the library just install the dependencies and run the build
script:
yarn install
yarn build
FAQs
Redux bindings for UI-Router
The npm package @uirouter/redux receives a total of 231 weekly downloads. As such, @uirouter/redux popularity was classified as not popular.
We found that @uirouter/redux demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.