mirror of
https://github.com/strapi/strapi.git
synced 2025-08-11 18:27:22 +00:00
30 lines
775 B
JavaScript
30 lines
775 B
JavaScript
![]() |
import React, { createContext, useContext } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
|
||
|
const HomePageContext = createContext({});
|
||
|
|
||
|
const HomePageContextProvider = ({ children, ...rest }) => {
|
||
|
return (
|
||
|
<HomePageContext.Provider value={rest}>{children}</HomePageContext.Provider>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
const useHomePageContext = () => useContext(HomePageContext);
|
||
|
|
||
|
HomePageContextProvider.defaultProps = {
|
||
|
pathname: '',
|
||
|
push: () => {},
|
||
|
setDataToEdit: () => {},
|
||
|
unsetDataToEdit: () => {},
|
||
|
};
|
||
|
|
||
|
HomePageContextProvider.propTypes = {
|
||
|
children: PropTypes.node.isRequired,
|
||
|
pathname: PropTypes.string,
|
||
|
push: PropTypes.func,
|
||
|
setDataToEdit: PropTypes.func,
|
||
|
unsetDataToEdit: PropTypes.func,
|
||
|
};
|
||
|
|
||
|
export { HomePageContext, HomePageContextProvider, useHomePageContext };
|