{"size": 541, "ext": "js", "max_stars_repo_path": "src/Context/loading/LoadingProvider.js", "max_stars_repo_name": "to82350/Viva-Pro.", "max_stars_repo_stars_event_min_datetime": "2021-06-07T17:19:21.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-07T17:19:21.000Z", "max_issues_repo_path": "src/Context/loading/LoadingProvider.js", "max_issues_repo_name": "to82350/Viva-Pro.", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Context/loading/LoadingProvider.js", "max_forks_repo_name": "to82350/Viva-Pro.", "max_forks_repo_forks_event_min_datetime": "2021-06-07T17:19:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-05T16:53:16.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 23.5217391304, "max_line_length": 87, "alphanum_fraction": 0.5582255083}
import React, {useState} from 'react';
import LoadingContext from './LoadingContext';

const LoadingProvider = ({children}) => {
    const setRequestId = id => {
        setState(prev => {
            return {
                ...prev,
                requestId: [...prev.requestId, id],
            };
        });
    };

    const [state, setState] = useState({
        requestId: [],
        setRequestId,
    });

    return <LoadingContext.Provider value={state}>{children}</LoadingContext.Provider>;
};

export default LoadingProvider;
