codedamn

React Redux Toolkit

Created by Piyush Garg about a year ago

0

No description provided

6 Comments

    0

    Didn't got much

    @arvindbaloda

    Arvind Baloda

    @arvindbaloda

    1

    can explain it little it more like how and what is happening , its way too fast watched twice still its all blury

    @gauravbisht

    Gaurav Bisht

    @gauravbisht

    1

    Not a good explanation for a first time, take time in explaining new content. I am very disappointed that a concept like redux is completed in so short duration. Complete waste of money.

    @initarsh

    Arsh Ali

    @initarsh

    0

    Not a good way of teaching.

    @aliraza786

    Ali Raza

    @aliraza786

    1

    i came here for my redux revision thanks for making me more confused , i feel my money got wasted now.

    @alkesh633050bd

    alkesh patil

    @alkesh633050bd

    0

    Hi, I was following the step and stuck upon an error like ! Error : Uncaught SyntaxError: The requested module '/src/redux/slices/CounterSlice.js?t=1696417582596' does not provide an export named 'counterReducer' (at store.js?t=1696417582596:2:9). and ! Error: CounterSlice.js? t=1696417817070:14 Uncaught Reference Error: counter is not defined at CounterSlice.js? t=1696417817070:14:40

    import { createSlice, createSelector} from '@reduxjs/toolkit';
    
    const counterSlice = createSlice({
    name: 'count',
    initialState: 0,
        reducers: {
            increment: (state) => state + 1,
    decrement: (state) => state - 1,
        }
    });
    
    Defining a selector
    export const getCount = createSelector(
    The first argument is a function that accepts the Redux store state.
    and returns the piece(s) of state this selector needs.
    (state) => state.counter,
    
    The second argument is a function that receives all arguments returned by
    the input selectors and returns some value based on that data.
    (counter) => counter
    )
    
    export const { increment, decrement } = counterSlice.actions;
    //Exporting Reducer
    export const counterReducer = counterSlice.reducer;
    
    

    This solution finally helped. I hope someone stuck on this can follow it.

    @pranshubasak

    Pranshu Basak

    @pranshubasak

Your comment