Can we make API call to set the initial state of reducer? – Reactjs
let initialData = { products:[] } const ItemReducer = (state = initialData, action) => { switch (action.type) { case "FETCHDATA": return { ...state, products: action.payload, }; } return state; } let [productdata, setProductdata] = useState(); const dispatch = useDispatch(); useEffect(()=>{…