I'm Learning reactjs from some courses/videos and so far I'm really bad at it and I checked a few times and i couldn't see the error. So I can't understand this error. Can somebody help please?? this is my code:
import React, { useState } from 'react';
import CartSummary from './CartSummary'
import CategoryList from './CategoryList'
import ProductList from './ProductList'
import {
Collapse,
Navbar,
NavbarToggler,
NavbarBrand,
Nav,
NavItem,
NavLink,
UncontrolledDropdown,
DropdownToggle,
DropdownMenu,
DropdownItem,
NavbarText
} from 'reactstrap';
const Navi = (props) => {
const [isOpen, setIsOpen] = useState(false);
const toggle = () => setIsOpen(!isOpen);
return (
<div>
<Navbar color="light" light expand="md">
<NavbarBrand href="/">Nortwind App</NavbarBrand>
<NavbarToggler onClick={toggle} />
<Collapse isOpen={isOpen} navbar>
<Nav className="mr-auto" navbar>
<NavItem>
<NavLink href="/components/">Components</NavLink>
</NavItem>
<NavItem>
<NavLink href="https://github.com/reactstrap/reactstrap">GitHub</NavLink>
</NavItem>
<CartSummary cart={this.props.cart}></CartSummary>
</Nav>
<NavbarText>Simple Text</NavbarText>
</Collapse>
</Navbar>
</div>
);
}
export default Navi;
this is the Error:
37 | <NavItem>
38 | <NavLink href="https://github.com/reactstrap/reactstrap">GitHub</NavLink>
39 | </NavItem>
> 40 | <CartSummary cart={this.props.cart}></CartSummary>
| ^ 41 | </Nav>
42 | <NavbarText>Simple Text</NavbarText>
43 | </Collapse>
So can someone help me please?
thiskeyword here. It is usually used with class based components. You are using a react functional component.thisis referring to here?propshas been declared as a parameter of your fat arrow function... There is nothis.