Q:

reactjs error : TypeError: Cannot read property 'props' of undefined

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?

A:

problem is in this line
<CartSummary cart={this.props.cart}></CartSummary>
Here you need to write
<CartSummary cart={props.cart}></CartSummary> as you use functional component

