Vikash Kumar 👨💻 👁️⃤
@becodewala
Full Stack Developer (MERN) 👨💻| YouTube (becodewala) 🚀 | Javascript 🌍
New auth method in market See the last authentication methods. I found on acentric ui.
👨💻Design Forgot password page with light/dark mode support. Tech: React+ Tailwind CSS + Typescript Drop Feedback 👇🗨️
🧩 What’s the difference between reducers and extraReducers?
🧩 How do you dispatch multiple actions in Redux Toolkit? You can dispatch multiple actions in sequence using useDispatch. 🔹 Example: dispatch(clearCart()); dispatch(showToast('Cart cleared!'));
🧩 How do you handle pending, fulfilled, and rejected states in createAsyncThunk? You use extraReducers inside your slice.
🧩 What is createAsyncThunk used for? - createAsyncThunk simplifies writing async actions (like fetching data from an API). It automatically generates three action types: pending – when the request starts fulfilled – when the request succeeds rejected – when the request fails
🧩 How do you write asynchronous logic in Redux Toolkit? Use the createAsyncThunk method — it helps you handle API calls or async operations cleanly, without manually writing thunks.
💠Redux Toolkit uses Immer under the hood in createSlice() and createReducer(). When you “mutate” state (like state.value++), Immer records the change and returns a new, updated state object.
🧩 How does Redux Toolkit handle immutability internally? 🔹 Explanation: In Redux, state must be immutable — you can’t directly modify it, you must create a copy and then update it. Traditionally, you had to do this manually: return { ...state, value: state.value + 1 };
💠What is the Provider component used for in Redux? The Provider component from react-redux makes the Redux store available to all React components in your app. Without Provider, your components won’t be able to access Redux state.
⚒️What are the useSelector and useDispatch hooks used for?
👨💻How do you access state from Redux Toolkit in a React component? Use the useSelector hook. import { useSelector } from 'react-redux'; const cartItems = useSelector(state => state.cart); This selects and subscribes to part of the state from the Redux store.
👨💻How do you combine multiple slices in Redux Toolkit? You can combine multiple slices (e.g., user, cart, products) by passing them to configureStore:
Reducer in redux-toolkit 👨💻Reducers are functions inside a slice that describe how state changes based on an action. Example: reducers: { increment: (state) => { state.value += 1; }, decrement: (state) => { state.value -= 1; }, }
👨💻What is the purpose of the configureStore() method? configureStore() simplifies store creation by: Automatically adding middleware like redux-thunk Enabling Redux DevTools Allowing easy reducer combination It’s the modern replacement for createStore().
👉 Whether you’re building your MVP or pitching to investors, Pitch Mint makes it easier to present your startup in style. 💡 Would love your feedback! Check it out here: pitch-mint-frontend.vercel.app #Startups #MVP #PitchDeck #IndieHackers #BuildInPublic
👨💻How do you configure a store in Redux Toolkit? import { configureStore } from '@reduxjs/toolkit'; import cartReducer from './cartSlice'; export const store = configureStore({ reducer: { cart: cartReducer, }, });
💠What is a store in Redux? 🔹 Explanation: The store is a central place that holds the entire state of your app. It: Keeps track of state Allows access via getState() Allows updating via dispatch(action) Registers listeners via subscribe()
United States Trends
- 1. Good Monday 27.2K posts
- 2. #MondayMotivation 31.4K posts
- 3. Rudy Giuliani 15.9K posts
- 4. Happy Birthday Marines 3,524 posts
- 5. 8 Democrats 11.3K posts
- 6. Steelers 54.1K posts
- 7. #ITZY_TUNNELVISION 37.9K posts
- 8. The BBC 431K posts
- 9. Semper Fi 3,977 posts
- 10. Mr. 4 4,713 posts
- 11. Resign 118K posts
- 12. Chargers 39.2K posts
- 13. Tim Kaine 25.2K posts
- 14. #Talus_Labs N/A
- 15. #USMC N/A
- 16. Tomlin 8,502 posts
- 17. Durbin 32.8K posts
- 18. 8 Dems 8,428 posts
- 19. Rodgers 21.9K posts
- 20. Angus King 20.5K posts
Something went wrong.
Something went wrong.