WebJamApps/JaMmusic

View on GitHub
src/providers/MakeProvider.tsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { useEffect } from 'react';

interface ImakeProviderProps { Context: any; fetches: any[]; setters: any[]; }

export const MakeProvider = (props: ImakeProviderProps) => {
  const { Context, fetches, setters } = props;
  const { Provider } = Context;

  useEffect(() => {
    fetches[0](setters[0]);
    fetches[1](setters[1]);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);// empty array here to stop it from repeatedly fetching

  return Provider;
};