我将redux-devtools与redux-devtools-dock-monitor和redux-devtools-log-monitor一起使用。
我遵循了文档。但是,在控制台中,我收到以下错误:
index.js:1452 Redux DevTools could not render.
You must pass the Redux store to <DevTools> either as a "store" prop
or by wrapping it in a <Provider store={store}>.
下面是我的Root组件
我正在使用redux-工具箱,并且希望通过不必在每个分派异步操作之后调用unwrapResult来减少代码重复。我通过向用户显示一条土司消息来处理所有分派操作的错误,因此我需要根据redux工具包展开包装。
理想情况下,我希望使用如下所示的钩子包装从useDispatch()函数返回的returned中的分派函数.
// Example of wrapped dispatch function
function SomeComponent() {
const dispatch = useWrappedAppDispatch()
return (
<button
我在我的应用程序中集成了redux。问题是它与其他组件一起工作得很好,但它在特定的一个组件上有问题。我得到了以下错误 ExceptionsManager.js:86 TypeError: _this.props.changeAlertedNetworkError is not a function
This error is located at:
in NetworkService (at App.js:21)
in Provider (at App.js:20)
in App (at renderApplication.js:40
我正在尝试用jest-enzyme测试连接的组件(react-redux)。我正在使用react-redux-mock store。当我运行我的测试来查找组件中的一个div时,它给出了这个错误。 Invariant Violation: Passing redux store in props has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext
我正在使用redux-observables与rxjs和一起进行重试,现在我有了这个epic,它将在服务器上请求,如果请求失败,它将调度redux操作并重试该函数。
defer(callApi).pipe(
catchError((error) => {
return actions.hasError(error) // dispatch to redux
}),
// this should retry the request 10 times
retryBackoff({
shouldRetry: true,
initialInterval:
App.tsx :类型“{}”缺少“IProps”类型中的下列属性: getProjects,projects
我遵循了示例(不确定这是否是最好的,但我很难找到一些使用react、redux、typescript和异步操作的好示例。不管有没有雷鸣,但似乎雷鸣是人们推荐的吗?我只想知道为什么我会得到这个错误,以及关于这是否是一个好方法的一些反馈。
我只是尝试实现一个项目,在那里我应该从一个api中获取一些项目。但是父组件抱怨没有向孩子发送道具?:S。
App.tsx
import React from "react";
import logo from "./logo.s
我正在尝试使用try/catch块为一个自定义WordPress插件添加一些错误处理,该插件通过Twitter API获取Tweet。
出于测试目的,我在类构造方法中抛出了一个异常。
class Twitter_Settings() {
public function __construct() {
throw new \Exception('test');
}
}
然后在我的插件文件中,我这样做:
function twitter_init_settings() {
try {
return new Twitter_S
这与我在Redux Saga生成器上遇到的一个问题有关。他们对call的定义之一是(不包括实现): // this is taken from redux saga and cannot be changed
function call<Fn extends (...args: any[]) => any>(
fn: Fn,
...args: Parameters<Fn>
): CallEffect<SagaReturnType<Fn>> { ... } 我试着这样叫它: function test<F extends (a
我在和Redux一起工作。我编写了名为products的操作,以便使用Axios从后端获取产品详细信息。在此过程中,如果用户在进程中导航到另一个页面,则使用cancel令牌取消HTTP请求。
但是,当我导航到另一个页面时,控制台中仍然出现了如下所示的错误。
index.js:1 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel a
我有一个反应组件,应该有3个道具:
isLoggedIn from local statelogInUser是来自redux state的动作dispatcheruser。
为什么下面的组件会生成这个类型记录错误?user和logInUser不应该由connect()提供吗?
/Users/myuser/sites/my-site/src/components/App/index.tsx
TypeScript error in /Users/my-user/sites/my-site/src/components/App/index.tsx(11,8):
Type '{}'
我在用Jest /酶编写的测试用例中遇到了一些问题。我有一个React / Redux组件,并且试图编写一个基本的测试,但是得到了以下错误:
Invariant Violation: ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was 'undefined'.
这是我的密码:
dashboardComponent.js
import '../stylesheets/dashboardCom