
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
@types/react-redux
Advanced tools
TypeScript definitions for react-redux
The @types/react-redux package provides TypeScript type definitions for the react-redux library, which allows React components to interact with a Redux store. It enables type checking and IntelliSense for react-redux functions and components when using TypeScript.
Provider Component Typing
The Provider component makes the Redux store available to any nested components that need to access the Redux store.
import { Provider } from 'react-redux';
import { store } from './store';
const App = () => (
<Provider store={store}>
{/* Your app components go here */}
</Provider>
);
connect Function Typing
The connect function connects a React component to the Redux store. It provides type checking for the mapStateToProps and mapDispatchToProps arguments, as well as the component's props.
import { connect } from 'react-redux';
interface Props {
todos: string[];
}
const TodoList: React.FC<Props> = ({ todos }) => (
<ul>{todos.map(todo => <li key={todo}>{todo}</li>)}</ul>
);
const mapStateToProps = (state: RootState) => ({
todos: state.todos
});
export default connect(mapStateToProps)(TodoList);
Hooks Typing
TypeScript types for the useSelector and useDispatch hooks from react-redux, which allow you to access the state and dispatch actions in a type-safe manner.
import { useSelector, useDispatch } from 'react-redux';
import { RootState } from './store';
const TodoList = () => {
const todos = useSelector((state: RootState) => state.todos);
const dispatch = useDispatch();
// Use dispatch with type-checked actions
// ...
return <ul>{todos.map(todo => <li key={todo}>{todo}</li>)}</ul>;
};
mobx-react provides React bindings for MobX, which is a state management library. It is similar to react-redux in that it allows React components to react to state changes, but it uses observables rather than a single store and actions.
zustand is a small, fast, and scalable bearbones state-management solution using simplified flux principles. Unlike react-redux, it doesn't require a Provider component or connect function, and it uses hooks for state management.
Recoil is a state management library for React that provides several capabilities similar to Redux. It allows you to manage global state with a more React-like API using atoms and selectors, which can be seen as an alternative to the Redux pattern.
npm install --save @types/react-redux
This package contains type definitions for react-redux (https://github.com/reduxjs/react-redux).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-redux.
These definitions were written by Qubo, Curits Layne, Frank Tan, Nicholas Boll, Dibyo Majumdar, Valentin Descamps, Johann Rakotoharisoa, Anatoli Papirovski, Boris Sergeyev, Søren Bruus Frank, Jonathan Ziller, Dylan Vann, Yuki Ito, Kazuma Ebina, Michael Lebedev, Lenz Weber, and Mark Erikson.
FAQs
TypeScript definitions for react-redux
The npm package @types/react-redux receives a total of 3,110,774 weekly downloads. As such, @types/react-redux popularity was classified as popular.
We found that @types/react-redux demonstrated a healthy version release cadence and project activity because the last version was released less than 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 uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.