{"size": 505, "ext": "js", "max_stars_repo_path": "client/src/contexts/CurrentPageProvider.js", "max_stars_repo_name": "dev-deepak-rawat/mern-crud-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/contexts/CurrentPageProvider.js", "max_issues_repo_name": "dev-deepak-rawat/mern-crud-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/src/contexts/CurrentPageProvider.js", "max_forks_repo_name": "dev-deepak-rawat/mern-crud-app", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.7058823529, "max_line_length": 77, "alphanum_fraction": 0.704950495}
import React, { createContext, useState, useContext } from 'react';

const CurrentPageContext = createContext({});

const CurrentPageContextProvider = ({ children }) => {
    const [currentPage, setCurrentPage] = useState('list');
    return (
        <CurrentPageContext.Provider value={{ currentPage, setCurrentPage }}>
            {children}
        </CurrentPageContext.Provider>
    )
}

export default CurrentPageContextProvider;

export const useCurrentPage = () => useContext(CurrentPageContext);
