0

When I used hooks in my sidebar why it is giving me that error

Error: Invalid hook call. Hooks can only be called inside of the body of a function component

my code

import React, { useState, createRef, useEffect, useRef } from 'react';
import { View, Text, Alert, StyleSheet } from 'react-native';

import {
  DrawerContentScrollView,
  DrawerItemList,
  DrawerItem,
} from '@react-navigation/drawer';

const CustomSidebarMenu = (props) => {
  const [userimage, setuserimage] = useState('');
return (
);
};
export default CustomSidebarMenu;
alex
  • 123
  • 8
  • Does this answer your question? [Invalid hook call. Hooks can only be called inside of the body of a function component](https://stackoverflow.com/questions/56663785/invalid-hook-call-hooks-can-only-be-called-inside-of-the-body-of-a-function-com) – Abe Jan 19 '22 at 06:10
  • no because I already have a functional component – alex Jan 19 '22 at 09:51
  • Why does your component return nothing? I don't think the return of this function is a valid component, and that may be your problem. – LukasDeco Feb 05 '22 at 05:33

0 Answers0