'How can I solve undefined is not an object (evaluating 'route.params.data') in react native?

I'm not so experienced in React Native, I'm working on my app and I'm getting this error but I don't know how I can solve it. Please help.

Below is part of my code:

  const HomeScreen = ({ route, navigation }) => {
  const [{ ios, appSettings, rtl_support }, dispatch] = useStateValue();
  const [categoryData, setCategoryData] = useState({ 0: 
  route.params.data });
  const [currentCategory, setCurrentCategory] = useState([]);
  const [loading, setLoading] = useState(false);
  const [bottomLevel, setBottomLevel] = useState(false);

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source