Closed
Description
Hey guys I am new to react, redux and typescript and I have been following the SPA template for React and Redux in VS2017.
I keep getting this error:
ERROR in [at-loader] ./ClientApp/components/Layout.tsx:9:15
TS2322: Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }>...'.
Type '{}' is not assignable to type 'Readonly'.
Property 'isLoading' is missing in type '{}'.
import * as React from 'react';
import { Link } from 'react-router-dom';
import { LinkContainer } from 'react-router-bootstrap';
import { Nav } from 'react-bootstrap';
import * as SportsState from '../store/Sport';
import { RouteComponentProps } from 'react-router';
import { ApplicationState } from '../store';
import { connect } from 'react-redux';
// At runtime, Redux will merge together...
type SportProps =
SportsState.SportsState // ... state we've requested from the Redux store
& typeof SportsState.actionCreators // ... plus action creators we've requested
& RouteComponentProps<{}>;
export class NavScroller extends React.Component<SportProps> {
componentWillMount() {
// This method runs when the component is first added to the page
//this.props.requestSports();
}
public render() {
return <div className="nav-scroller bg-white box-shadow mb-4">
<Nav className="nav nav-underline" >
{this.props.sports && this.props.sports.map(sport =>
<Link className='nav-link' to={`/Sport/${sport.id}`}>
<img src={`../images/icons/${sport.name}.svg`}/>{sport.name}
</Link>
)}
</Nav>
</div>
}
}
export default connect(
(state: ApplicationState) => state.sports, // Selects which state properties are merged into the component's props
SportsState.actionCreators // Selects which action creators are merged into the component's props
)(NavScroller) as any;
import * as React from 'react';
import { NavMenu } from './NavMenu';
import { NavScroller } from './NavScroller';
export default class Layout extends React.Component<{}> {
public render() {
return <div>
<NavMenu />
<NavScroller/> <-----ERROR IS HERE
{this.props.children}
</div>;
};
}