Open dineshbhati61102 opened 1 year ago
import React, { useEffect, useState } from 'react' import { Link } from 'react-router-dom' import LeftNav from './LeftNav' import { useDispatch, useSelector } from "react-redux" import { GetMaincategoryAction } from "../../Store/Actions/MaincategoryAction"
const AdminMaincategories = () => { const [Maicategories, setMaicategories] = useState([]); const dispatch = useDispatch(); const { data, error } = useSelector(state => state.MaincategoryStateData);
function getAPIData(){ dispatch(GetMaincategoryAction()) if(data.length) setMaicategories(data) }
useEffect(() => { getAPIData() }, [data.length])
return ( <>
</>
) }
export default AdminMaincategories
import React, { useEffect, useState } from 'react' import { Link } from 'react-router-dom' import LeftNav from './LeftNav' import { useDispatch, useSelector } from "react-redux" import { GetMaincategoryAction } from "../../Store/Actions/MaincategoryAction"
const AdminMaincategories = () => { const [Maicategories, setMaicategories] = useState([]); const dispatch = useDispatch(); const { data, error } = useSelector(state => state.MaincategoryStateData);
function getAPIData(){ dispatch(GetMaincategoryAction()) if(data.length) setMaicategories(data) }
useEffect(() => { getAPIData() }, [data.length])
return ( <>
Maincategories
Add New{error}
: Array.isArray(Maicategories) && Maicategories.map((elem, index) => { return) }
export default AdminMaincategories