Onboarding\hooks\useOnBoardingFilter.tsx

src\ui\components\widgets\Onboarding\hooks\useOnBoardingFilter.tsx
mail@pastecode.io avatar
unknown
typescript
a month ago
606 B
4
Indexable
Never
import { useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'

function useOnBoardingFilter() {
  const dispatch = useDispatch()
  const { routesByRailroad } = useSelector((state: any) => state.portalData)
  const [routes, setRoutes] = useState<any[]>()

  useEffect(() => {
    const fetchFilterData = async () => {
      setRoutes(routesByRailroad?.data)
    }
    fetchFilterData()
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [routesByRailroad])
  return {
    routes: routes || []
  }
}

export default useOnBoardingFilter
Leave a Comment