I have a component in React that shows a navigation based on a prop. I cannot figure out why I am getting this error when I'm trying to run the application:
(19,8): Type '{}' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<TableSystems> & Readonly<{ children?: ReactNode; }...'.
Type '{}' is not assignable to type 'Readonly<{ todos: any; showNav: boolean; }>'.
Property 'todos' is missing in type '{}'.
My component look like this:
import * as React from 'react'
import Navigation from '../components/Navigation'
import TableSystems from '../components/TableSystems'
class SystemTable extends React.PureComponent<{showNav: boolean }> {
render(){
return (
<div >
<div >
<div className="navigationContainer">
<Navigation {...this.props.showNav} className="sideMenu"/>
<TableSystems/>
</div>
</div>
</div>)
}
}
export default SystemTable
I can't find what's the problem here.
The component looks like this:
import * as React from 'react';
import history from '../history';
class Navigation extends React.Component<any> {
constructor(props){
super(props);
this.toVersions = this.toVersions.bind(this);
}
toVersions(){
history.push('/versions');
}
render() {
var style = this.props.visible ? "toggled" : "";
console.log(style);
return (
<div className={style} id="wrapper">
<div id="sidebar-wrapper">
<ul className="sidebar-nav">
<li className="sidebar-brand">
<a href="#">
Menu
</a>
</li>
<li >
<a className="nav-link" href="#">List1</a>
</li>
<li >
<a className="nav-link" href="#">List2</a>
</li>
<li >
<a className="nav-link" href="" onClick={this.toVersions}>List3</a>
</li>
<li >
<a className="nav-link" href="#">List4</a>
</li>
</ul>
</div>
</div>
)
}
}
export default Navigation
propsnotshowNav, as in not{...this.props.showNav}not{...this.props}