React - Error: Invalid Hook Call. Hooks Can Only Be Called Inside Of The Body Of A Function Component
I wanted to use 'React Bootstrap Hamburger Menu' HamburgerMenu copied the code from there and I get an error errorScreen 'Error: Invalid hook call. Hooks can only be called inside
Solution 1:
It seems there is some kind of problem when we use the mdbootstrap Library MDBNavLink component. I didn't go deep on that to be able to explain why, though.
I solved this problem by importing the Link component from react-router-dom and use it instead with the className='nav-link'.
import { Link } from"react-router-dom";
//Snippet// [....]<MDBNavItem><LinkclassName='nav-link'exactto='/'onClick={closeCollapse('mainNavbarCollapse')}
>
Home
</Link></MDBNavItem>// [...]
Post a Comment for "React - Error: Invalid Hook Call. Hooks Can Only Be Called Inside Of The Body Of A Function Component"