import React, { useState, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import catchErrors from '../utils/catchErrors';
import { Navbar, Nav } from 'react-bootstrap';
function SubNav() {
const [categoriesDiv, setCategoriesDiv] = useState([])
const [error, setError] = useState('')
useEffect(async () => {
try {
const response = await axios.get('/api/categories/main')
let list = []
Object.keys(response.data[0]).forEach((ele) => {
const url = ele.toLowerCase()
list.push(
{ele}
)
})
setCategoriesDiv(list)
} catch (error) {
catchErrors(error, setError)
}
}, [])
return (
)
}
export default SubNav