我目前正在尝试使用get请求更新Redux reducer到,我可以从我的笔记本电脑卷曲这个网站,但当我尝试从我的应用程序的axios.get(网址/数据)时,数据永远不会被记录,所以我假设承诺永远不会回来?我在代理之后,但是已经为代理配置了NodeJs,所以我不确定是否必须将一些额外的数据传递给与代理相关的axios,或者不传递外部GET请求。基本上,应用程序的逻辑应该展开如下:
GET Data from site with axios and is logged in firefox web console->reducer is passed payload from GET-&
我对Redux的反应有问题。在输入这个帖子的标题后,我一直在研究一些相关的问题,但我无法为我的案例找到同样的问题的答案。
我有以下文件:
Index.JS
import snackbarContentReducer from '../src/shared/redux/reducers/snackbar-reducer';
import shoppingCartReducer from '../src/shared/redux/reducers/shopping-cart-reducer';
import userReducer from '../src/
我正在构建一个应用程序。此应用程序需要请求产品数据的woocommerce API。API一次只允许100个项目,所以我不得不用动态页面参数调用这个请求4次。 我对这些数据的目标是让reducer将数据组合到一个可以在react组件中过滤的数组中。 我现在的问题是,我的reducer将每个API调用添加到自己的数组中。所以不是一个包含300个ish产品的大数组,而是一个包含4个数组的数组,每个数组包含100个产品。请看下面的图片。 State data result 下面是操作: export function fetchJuiceData(page) {
return dispatch
我正在尝试使用钩子,但我不能弄清楚出现的问题。我想在useEffect中设置令牌值,但是我不能定义它。 import React, { useEffect } from "react";
import "./App.css";
import Login from "./Login";
import { getTokenFromUrl } from "./spotify";
import SpotifyWebApi from "spotify-web-api-js";
import Player from "
第一次使用Redux时,我理解操作和还原器的概念,但无法让它们在我的代码中很好地发挥作用,我担心这是因为我使用的是CoffeeScript而不是ES6。
我想问题是,我不能在我的/app/reducers/index.export default ...中做¯\_,但老实说,Redux对我来说是非常新的,我和webpack一起蹒跚而行,反应了一段时间,而且仍然对两者都不太舒服,所以¯\_(ツ)_/ my
我不断地发现错误:
Store does not have a valid reducer. Make sure the argument passed to combineReducers
我无论如何也想不出这个问题。我正在尝试显示用户信息,并且我知道api在127.0.0.1/api/ user /1下工作。但是,当我尝试传递参数时,我总是得到未定义的属性。这是我的路由器,用来证明我传入的是一个id
import React from 'react'
import { Route } from 'react-router-dom'
import ArticleListView from '../containers/ArticleListView'
import ArticleDetailView from '../con
这里有一个动作创建者:
export function selectBook(book) {
// selectBook is an ActionCreator, it needs to return an action,
// an object with a type property.
return {
type: 'BOOK_SELECTED',
payload: book,
};
}
这里有一个简单的缩减程序:
export default function() {
return [
{ title: 'Javasc
找不到任何相关的答案,唯一的答案是直接与Redux有关,因此提出的问题对你们中的一些人来说似乎是显而易见的。就我的代码而言,一切似乎都是正确的,但我仍在与以下错误作斗争:期望0参数,但得到了1
代码:
// An enum with all the types of actions to use in our reducer
enum ActionType {
INCREASE = 'INCREASE',
}
// An interface for our actions
interface Action {
types: ActionType;
嗨,我是新来的反应和还原,我创建了一个poc并得到了这个错误,尽管我的努力,我无法解决这是我的代码。
购物-app/app/index.jsx
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import {createStore} from 'redux'
import reducer from './reducers/index.js'
import {Provider} from 'react-redux'
l