Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
how to debug error exporting action in react redux

I am building a e commerce store with react and redux. I am getting an Error that says I am not importing an action from 'productAction.js' to 'homeScreen.js '. I have tried to auto import the the action but it will not compile. I want the listProduct action to be read and the property of products.

import React, { useEffect } from 'react';
import Product from '../components/product';
import { useDispatch, useSelector } from 'react-redux';
import { listProducts } from '../actions/productActions';

export default function HomeScreen() {
  const dispatch = useDispatch();
  const productList = useSelector(state => 
 state.productList);
  const { products } = productList;
  useEffect(() => {
    dispatch(listProducts());
  },[dispatch]);

  return (
    <div>
      <div className="row center">
        {products.map((product) => (
          <Product key={product._id} product={product}> 
   </Product>
        ))}
      </div>
    </div>
  );
}

import { PRODUCT_LIST_FAIL, PRODUCT_LIST_REQUEST, PRODUCT_LIST_SUCCESS } from "../constants/productConstants"
import axios from 'axios'

 const listProducts = ( ) => async(dispatch) => {
dispatch({
    type: PRODUCT_LIST_REQUEST
})
 try{
    const { data } = await 
    axios.get('https://fakestoreapi.com/products')
    dispatch({type:PRODUCT_LIST_SUCCESS,payload:data})
    }catch (error) {
        dispatch({type:PRODUCT_LIST_FAIL,payload:error.message});
 }
}
export default listProducts;

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!