685 viewsMern Amazona

Hello Basir  ,

I had a problem to fetch the data from the backend since i am using Vite instead of create-react-app , i solved this problem by changing the proxy params in vite.config.js file instead of the proxy in package.json .

Then , when i tried to implement useReducer EXACTLY like you did , the loading message was appearing .
I’ve tried to debug it and understood that the function fetchData was not even called once and i don’t understand why …

Here’s my vite.config :

import { defineConfig } from ‘vite’
import react from ‘@vitejs/plugin-react’
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
proxy: {
‘/api/products’: {

Bassir Posted new comment March 10, 2023

Great, you fix the issue

Bassir Answered question March 9, 2023

for vite I suggest to use this code:


Bassir Answered question March 9, 2023