Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3312 | Rev 3314 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3312 Rev 3313
Línea 1... Línea 1...
1
import React, { createContext, useCallback } from 'react'
1
import React, { createContext, useCallback } from 'react'
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea 3...
3
import { useFetch } from '@hooks'
3
import { useFetch } from '@hooks'
Línea 4... Línea 4...
4
 
4
 
5
export const HabitsContext = createContext()
5
export const MyProgressContext = createContext()
6
 
6
 
7
export default function ProgressProvider({ url, children }) {
7
export default function MyProgressProvider({ url, children }) {
8
  const { data: habits, isLoading: loading } = useFetch(
8
  const { data: habits, isLoading: loading } = useFetch(
Línea -... Línea 9...
-
 
9
    '/helpers/habits-and-skills/my',
-
 
10
    []
-
 
11
  )
-
 
12
 
-
 
13
  const getHabitById = useCallback(
9
    '/helpers/habits-and-skills/my',
14
    (habitId) => habits.find((habit) => habit.uuid === habitId),
10
    []
15
    [habits]
11
  )
16
  )
12
 
17
 
13
  return (
18
  return (
14
    <HabitsContext.Provider value={{ loading, habits }}>
19
    <MyProgressContext.Provider value={{ loading, habits, getHabitById }}>