
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@dev-plus-plus/redux-wrapper
Advanced tools
Make simple the way of using Redux
npm install @dev-plus-plus/redux-wrapper
In order to simplify the use of Redux, you have to use wrappers provided in this library.
They have to extend your reducers as the following:
import {ReducerWrapper} from '@dev-plus-plus/redux-wrapper'
import {LanguageDispatcher} from './dispatchers/LanguageDispatcher'
export class AppReducer extends ReducerWrapper<AppType, AppState, AppAction> {
protected readonly initialState: AppState = {
language: 'en-US',
}
protected readonly dispatchers = [LanguageDispatcher]
readonly getters = (state: RootState) => ({
app: state.app,
})
readonly actions = {
setLanguage: (language: string) => {
return this.commit('SET_LANGUAGE', {language})
},
}
}
import {DispatcherWrapper} from '@dev-plus-plus/redux-wrapper'
export class LanguageDispatcher extends DispatcherWrapper< AppType, AppState, AppAction > {
readonly type = 'SET_LANGUAGE'
readonly reducer: AppReducer = (state, action) => {
const {language} = action
return this.set(state, {language})
}
}
import {Action} from 'redux'
import type {ReducerApplied} from '@dev-plus-plus/redux-wrapper'
export declare global {
type AppType = 'SET_LANGUAGE'
interface AppState {
language: string
}
type AppAction = AppState & Action<AppType>
type AppReducer = ReducerApplied<AppState, AppAction>
}
import {combineReducers} from 'redux'
import {AppReducer} from './app/AppReducer'
export type RootState = ReturnType<typeof RootStore.reducers>
export abstract class RootStore {
static readonly app = new AppReducer()
static readonly reducers = combineReducers({
app: RootStore.app.reducer,
})
}
import * as React from 'react'
import type {Store} from 'redux'
import {Provider} from 'react-redux'
import {createStore} from 'redux'
import type {RootState} from './store/RootStore'
import {RootStore} from './store/RootStore'
import Home from './Home'
const store: Store<RootState> = createStore(RootStore.reducers)
export default function App() {
return (
<Provider store={store}>
<Home />
</Provider>
)
}
import * as React from 'react'
import {Button, StyleSheet, Text, View} from 'react-native'
import {useDispatch, useSelector} from 'react-redux'
import type {RootState} from './store/RootStore'
import {RootStore} from './store/RootStore'
export default function Home() {
const {app} = useSelector(RootStore.app.getters)
const {language} = app
const dispatch = useDispatch()
const changeLanguage = (val: string) => {
dispatch(RootStore.app.actions.setLanguage(val))
}
return (
<View style={styles.container}>
<Text style={{fontSize: 24, marginBottom: 16}}>
Current language: {language}
</Text>
<Button
title={'Change to pt-BR'}
onPress={() => changeLanguage('pt-BR')}
/>
<Button
title={'Change to en-US'}
onPress={() => changeLanguage('en-US')}
/>
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
})
MIT
FAQs
Make simple the way of using Redux
We found that @dev-plus-plus/redux-wrapper 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.