我有一个简单的样板项目,与内联类声明相比,当我导入一个顶级(智能)组件时,我体验到了不同的行为。
创建类不会导致任何错误,但是当我将类提取到一个单独的文件中时,我收到以下错误:
Warning: Failed propType: Required prop `routerState` was not specified in `AppContainer`. Check the render method of `RoutingContext`.
我已尝试内联整个文件,但错误消失了
// == Import ============================================
我将React与semantic-ui-react库一起使用。问题是,当我使用semantic-ui调光器并尝试将其中的一个组件连接到redux时,我得到了错误:Uncaught Invariant Violation: Could not find "store" in the context of "Connect(myComp)"。我设法克服了这个错误,将内部组件包装在Provider中,如下所示: import { Dimmer } from 'semantic-ui-react'
import { Provider } from
我有一个类扩展了react.component。另一个类从这个类扩展到一个redux存储。
import React from 'react'
class A extends React.Component{
constructor(props){super(props); ...}
...
}
import React from 'react'
import {connect} from 'react-redux'
@connect(store=>{...})
class B extends A{
constru
我正在尝试用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
我正在学习如何用酶来测试React/Redux成分。该组件以应用程序级别的状态作为支持。当我运行测试时,我会得到以下错误:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
TypeError: Cannot read property 'contextTypes' of undefined
在尝试使用react-redux中的connect()函数时,我收到以下错误
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `App`.
这是App:
import { Provider } from 'react-redux';
import configureStore from './stor
我正在尝试将react路由器与TypeScript一起使用。但是,我在使用withRouter函数时遇到了一些问题。在最后一行,我得到了一个非常奇怪的错误:
Argument of type 'ComponentClass<{}>' is not assignable to parameter of type 'StatelessComponent<RouteComponentProps<any>> | ComponentClass<RouteComponentProps<any>>'.
Type
我看到了这个主题,但它并不是关于我的案例。
那么,我无法理解我的表示/容器连接出了什么问题?
我将它们彼此连接起来,但我得到了一个错误:You must pass a component to the function returned by connect. Instead received undefined
/*组件*/
import React from 'react';
import AddTodo from '../../Actions/AddTodo'
import TodoFormAdd from '../../Containers/To
我正在使用and redux将redux连接到我的redux本机项目,但是当我使用export default connect(state => ({ count: state.count }))(Test)方法并导入作为creactStackNavigator({test:Test})的响应导航时,它将显示
The component for route 'test' must be a React component
import MyScreen from './MyScreen';
...
test: MyScreen,
}
但是当我移除conn
我正在使用reactJS创建一个待办事项列表应用程序。如果我在两个单独的文件中编写两种不同的逻辑,它的工作就会很好,但是当将这两个文件组合在一起时,它会产生一个错误。
RenderRemaining.js文件:
import React from 'react';
import { connect } from 'react-redux';
import store from '../store/store';
import RenderRemainingData from './RenderRemainingData';
co
我正在尝试学习redux表单和typescript,但我遇到了一个我无法解决的错误。 错误是:Property 'submitAction' is missing in type '{}' but required in type 'Readonly<IDispatchProps & Partial<ConfigProps<IUser, IDispatchProps, string>>>'.ts(2741) 这就是我认为错误的地方。 //Form.tsx import * as React from