React Redux Store in React App 2025
React Redux Store in React App 2025
Redux Store ek central place hota hai jahan poori application ki state store hoti hai. React app mein store ko create karna aur usse application ke saath integrate karna bahut important hota hai. Chaliye step-by-step dekhte hain.
1. Install Redux & React-Redux
npm install @reduxjs/toolkit react-redux
2. Create a Redux Store
// src/app/store.js
import { configureStore } from '@reduxjs/toolkit';
import counterReducer from '../features/counter/counterSlice';
export const store = configureStore({
reducer: {
counter: counterReducer,
},
});
3. Provide the Store to React App
// src/index.js or main.jsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { Provider } from 'react-redux';
import { store } from './app/store';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
);
4. Folder Structure Example
src/
├── app/
│ └── store.js
├── features/
│ └── counter/
│ ├── counterSlice.js
│ └── Counter.jsx
├── App.js
└── index.js
Ab aapka Redux store ready hai aur poori React app mein use kiya ja sakta hai using Redux Toolkit & react-redux
.