我有一个组件(TourSpecPropertiesSection),它可以访问存储中的对象。我希望它获取这个对象的属性,并将每个属性映射到另一个组件(TourSpecProperty),该组件将暂时显示名称和值。我已经创建了这两个组件,但是当我尝试在TourSpecPropertiesSection中实例化TourSpecProperty时,我无法设置TourSpecProperty的属性,即使我已经在接口中定义了它们。它会给我一个错误
"Property 'name' does not exist on type 'IntrinsicAttributes &a
我一直在调试这个程序,但毫无头绪,我逐字逐句地遵循教程,试图制作一个TODO应用程序,但我不知道为什么我会收到这个错误消息。
./src/cuers.js
第12行:“分派”未定义为no-undef
第13行:“分派”未定义为no-undef
components.js
import React from 'react'
class Todo extends React.Component {
render() {
const { todo } = this.props
if (todo.isDone) {
我想声明,我的function redux mapStateToProps函数正在返回正确类型的属性,并且不会遗漏任何属性。
如果我这样做的话,它就会抱怨道具的派遣。如果我没有做到$Exact,我认为它不会抓住丢失或额外的道具。
我在想,myComponent可以声明一个带有类型道具的静态字段,这样我就可以从那里读取类型,但这似乎是一个黑客,我需要对每个组件都这样做。
在src/mycomponent/index.js中
import {connect} from 'react-redux'
import type {Props} from './myComponent
我有以下内容:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { logoutUser } from '../actions';
class NavBar extends Component {
onLogoutClick() {
this.props.logoutUser();
this.props.history.push('/login'); // here is the
在我的React项目中,我的App组件出现了以下错误。 Type '{}' is missing the following properties from type 'Pick<ClassAttributes<App> & RouteChildrenProps<{}, unknown> & { userData: UserDataType | undefined; userRightList: UserRightListType[] | undefined; userPermissionList: string[] |
如何使用state属性从react-redux指定由react-meteor-data注入的数据
react组件的结构如下:
import React from "react";
import {createContainer} from "meteor/react-meteor-data";
import {connet} from "react-redux";
import {Data} from "./data.js"
class App extends React.Component {
r
我遵循JavaScript中的redux教程,但是当我用TypeScript编写时,我无法将状态映射到道具。
App.tsx
import * as React from 'react';
import Todo from '../models/Todo';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import Main from './Main';
export interface State {