Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
redux-logger
Advanced tools
redux-logger is a middleware for Redux that logs actions and state changes to the console, making it easier to debug and understand the flow of data in your application.
Basic Logging
This feature logs every action and the resulting new state to the console. It helps developers see what actions are being dispatched and how the state is changing in response.
const { createStore, applyMiddleware } = require('redux');
const logger = require('redux-logger').createLogger();
const reducer = (state = {}, action) => state;
const store = createStore(reducer, applyMiddleware(logger));
store.dispatch({ type: 'TEST_ACTION' });
Collapsed Logging
This feature collapses the log entries for each action, making the console output more compact and easier to navigate, especially when dealing with a large number of actions.
const { createStore, applyMiddleware } = require('redux');
const { createLogger } = require('redux-logger');
const logger = createLogger({ collapsed: true });
const reducer = (state = {}, action) => state;
const store = createStore(reducer, applyMiddleware(logger));
store.dispatch({ type: 'TEST_ACTION' });
Predicate Logging
This feature allows you to filter which actions get logged based on a predicate function. In this example, actions of type 'IGNORED_ACTION' will not be logged.
const { createStore, applyMiddleware } = require('redux');
const { createLogger } = require('redux-logger');
const logger = createLogger({ predicate: (getState, action) => action.type !== 'IGNORED_ACTION' });
const reducer = (state = {}, action) => state;
const store = createStore(reducer, applyMiddleware(logger));
store.dispatch({ type: 'TEST_ACTION' });
store.dispatch({ type: 'IGNORED_ACTION' });
redux-devtools-extension is a package that integrates Redux with the Redux DevTools browser extension. It provides a more visual and interactive way to inspect actions and state changes, including time-travel debugging, which is not available in redux-logger.
redux-immutable-state-invariant is a middleware that logs warnings when the state is mutated. While it doesn't log actions and state changes like redux-logger, it helps catch bugs related to state mutations, which can be a complementary tool for debugging Redux applications.
npm i --save redux-logger
import logger from 'redux-logger';
const createStoreWithMiddleware = applyMiddleware(logger)(createStore);
const store = createStoreWithMiddleware(reducer);
MIT
FAQs
Logger for Redux
The npm package redux-logger receives a total of 753,332 weekly downloads. As such, redux-logger popularity was classified as popular.
We found that redux-logger 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.