{"library":"redux","title":"Redux","description":"Redux is a predictable state container for JavaScript applications. It helps manage application state consistently across different environments and simplifies testing. The current stable version is 5.0.1, which includes bug fixes and type adjustments. Redux maintains an active development cycle with regular patch releases and coordinated major updates, often alongside Redux Toolkit and React-Redux.","language":"javascript","status":"active","last_verified":"Sat Apr 18","install":{"commands":["npm install redux"],"cli":null},"imports":["import { createStore } from 'redux'","import { combineReducers } from 'redux'","import { applyMiddleware } from 'redux'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { createStore } from 'redux';\n\ninterface AppState {\n  counter: number;\n}\n\ntype Action = { type: 'INCREMENT' } | { type: 'DECREMENT' };\n\nconst initialState: AppState = { counter: 0 };\n\nfunction reducer(state: AppState = initialState, action: Action): AppState {\n  switch (action.type) {\n    case 'INCREMENT':\n      return { ...state, counter: state.counter + 1 };\n    case 'DECREMENT':\n      return { ...state, counter: state.counter - 1 };\n    default:\n      return state;\n  }\n}\n\nconst store = createStore(reducer);\n\nconsole.log('Initial state:', store.getState());\n\nstore.dispatch({ type: 'INCREMENT' });\nconsole.log('State after increment:', store.getState());\n\nstore.dispatch({ type: 'DECREMENT' });\nconsole.log('State after decrement:', store.getState());\n\n// Note: For new applications, it is highly recommended to use Redux Toolkit's `configureStore`\n// and `createSlice` for a more efficient and simpler setup.","lang":"typescript","description":"This quickstart demonstrates a basic Redux store setup using `createStore`, a simple reducer, and dispatching actions. It shows how to initialize the store, retrieve the current state, and update it via actions.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}