I have face with the below codes, and also i am new in this sector, so if anybody can help me to solve the problem

function productListReducer(state = { products: [] }, action) {

    switch (action.type) {

        case PRODUCT_LIST_REQUEST:

            return { loading: true };

        case PRODUCT_LIST_SUCCESS:

            return { loading:false, products: action.payload };

        case PRODUCT_LIST_FAIL:

            return { loading: false, error: action.payload }

        default:

            return state;

    }

}

export { productListReducer }

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

can you give some more context? what is your issue? what’s going wrong?

export default function productListReducer(state = { products: }, action) {

switch (action.type) {

  case PRODUCT_LIST_REQUEST:

    return { loading: true };

  case PRODUCT_LIST_SUCCESS:

    return { loading: false, products: action.payload };

  case PRODUCT_LIST_FAIL:

    return { loading: false, error: action.payload }

   default:

       return state;

}

}

export { productListReducer }

Looks like okay but when i run in terminal , the message used to say:
Failed to compile

./src/reducers/productReducers.js  Line 5:12:  'PRODUCT_LIST_REQUEST' is not defined  no-undef  Line 7:12:  'PRODUCT_LIST_SUCCESS' is not defined  no-undef  Line 9:12:  'PRODUCT_LIST_FAIL' is not defined     no-undefSearch for the keywords to learn more about each error.

This error occurred during the build time and cannot be dismissed.