Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
redux-reloaded
Advanced tools
![advertisement](https://raw.githubusercontent.com/ginger-io/redux-reloaded/master/advertisement.jpg)
Typesafe Redux, without all the boilerplate...and more.
import { createAction, createReducer } from "redux-reloaded"
/** Define all your actions in an Enum */
export enum Actions {
SELECT_PATIENT = "SELECT_PATIENT"
}
/** Create what Redux calls an "Action Creator" - i.e. a function that returns an action */
export const selectPatient = createAction(
Actions.SELECT_PATIENT,
(id: string) => ({
patientId: id
})
)
/** Create a reducer that operates on State, with some initial state */
type State = {}
export const reducer = createReducer<State>({
selectedPatientId: null
})
/** And when we see the selectPatient action, update our State... */
reducer.on(selectPatient, (state, { payload }) => ({
...state,
selectedPatientId: payload.patientId
}))
Often you want to take some async action based on a Redux event - e.g. call an API, wait for the response and update the UI at a later time. That's what redux-thunk and redux-saga are for.
But both of those options have their tradeoffs. redux-reloaded aims to be easy to use and simple to test. It's just like DOM event-listeners, but for Redux events. You bind a "handler" to your event, and it runs every time that event is triggered.
import { createActionHandlers, createActionHandlerMiddleware } from "redux-reloaded"
import { applyMiddleware, createStore } from "redux"
// Stick objects you want your async acion your services
type Services = {
apiClient: APIClient
}
const services: Services = ...
type State = {
}
export const actionHandlers = createActionHandlers<Services, State>()
actionHandlers.on(selectPatient, async ({ action, context, redux }) => {
const foo = await context.apiClient.getFoo()
redux.dispatch(...)
})
export const store = createStore(
rootReducer,
undefined,
applyMiddleware(
createActionHandlerMiddleware({ services }, [actionHandlers])
)
)
FAQs
![advertisement](https://raw.githubusercontent.com/ginger-io/redux-reloaded/master/advertisement.jpg)
We found that redux-reloaded 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.